Skip to main content

@webda/coreReadme | API


Class: AsyncEvent

AsyncEvent representation

Constructors

new AsyncEvent(service, type, payload)

new AsyncEvent(service, type, payload): AsyncEvent

Parameters

service: string | CoreModelDefinition<CoreModel> | Service<ServiceParameters, Events>

type: any

payload: Object= {}

Returns

AsyncEvent

Source

packages/core/src/services/asyncevents.ts:31

Properties

payload

payload: any

Payload of the event

Source

packages/core/src/services/asyncevents.ts:20


service

service: string

Service emitted the event

Source

packages/core/src/services/asyncevents.ts:12


time

time: Date

Time

Source

packages/core/src/services/asyncevents.ts:24


type

type: string

Type of event

Source

packages/core/src/services/asyncevents.ts:16


ServiceTag

static ServiceTag: string = "#Webda:Service:"

Used when serializing a service

Source

packages/core/src/services/asyncevents.ts:29

Methods

getMapper()

getMapper(): string

Mapper name

Returns

string

Source

packages/core/src/services/asyncevents.ts:89


toJSON()

toJSON(): AsyncEvent & Object

Allow payload to contain Service but do not serialize them replacing them by a #Webda:Service:${service.getName()} so it can be revived

Returns

AsyncEvent & Object

Source

packages/core/src/services/asyncevents.ts:51


fromQueue()

static fromQueue(data, service): AsyncEvent

Deserialize from the queue, reviving any detected service

Parameters

data: any

service: Service<ServiceParameters, Events>

Returns

AsyncEvent

Source

packages/core/src/services/asyncevents.ts:70