Skip to content

Event<T>

Defined in: event.ts:27 ↗

Allows attaching handlers and broadcasting events.

Type Parameters

T extends unknown[]

Implements

Constructors

new Event()

ts
new Event<T>(options?): Event<T>

Defined in: event.ts:33 ↗

Creates new event instance.

Parameters

options?

EventOptions

Returns

Event<T>

Accessors

last

Get Signature

ts
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

EventSubscriber.last

Methods

broadcast()

ts
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

EventBroadcaster.broadcast


subscribe()

ts
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

EventSubscriber.subscribe


subscribeById()

ts
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()

ts
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

EventSubscriber.unsubscribe


unsubscribeById()

ts
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