Event<T>
Defined in: event.ts:27
Allows attaching handlers and broadcasting events.
Type Parameters
• T extends unknown
[]
Implements
Constructors
new Event()
new Event<T>(options?): Event<T>
Defined in: event.ts:33
Creates new event instance.
Parameters
options?
Returns
Event
<T
>
Accessors
last
Get Signature
get last(): undefined | [...T[]]
Defined in: event.ts:79
In case event was broadcast at least once, returns last payload; undefined otherwise.
Returns
undefined
| [...T[]
]
In case event was broadcast at least once, returns last payload; undefined otherwise.
Implementation of
Methods
broadcast()
broadcast(...args): void
Defined in: event.ts:39
Notifies attached handlers with specified payload.
Parameters
args
...[...T[]
]
The payload of the notification.
Returns
void
Implementation of
subscribe()
subscribe(handler): string
Defined in: event.ts:47
Attaches specified handler for events emitted by this event instance.
Parameters
handler
(...args
) => void
The handler to attach.
Returns
string
Implementation of
subscribeById()
subscribeById(id, handler): void
Defined in: event.ts:64
Attaches handler with specified identifier for events emitted by this event instance.
Parameters
id
string
Identifier of the handler.
handler
(...args
) => void
The handler to attach.
Returns
void
unsubscribe()
unsubscribe(handler): void
Defined in: event.ts:55
Detaches specified handler from events emitted by this event instance.
Parameters
handler
(...args
) => void
The handler to detach.
Returns
void
Implementation of
unsubscribeById()
unsubscribeById(id): void
Defined in: event.ts:72
Detaches handler with specified identifier from events emitted by this event instance.
Parameters
id
string
Identifier of the handler.
Returns
void