EventDispatcherMapBase
Defined in: packages/async/src/events/event-dispatcher-map-base.ts:16
Interface representing an object that allows listeners to register for event dispatching.
Type Parameters
Section titled “Type Parameters”Events
Section titled “Events”Events extends Record<PropertyKey, unknown[]>
A record mapping event names to their argument tuple types.
Implements
Section titled “Implements”IEventDispatcherMap<Events>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new EventDispatcherMapBase<
Events>():EventDispatcherMapBase<Events>
Returns
Section titled “Returns”EventDispatcherMapBase<Events>
Methods
Section titled “Methods”isSubscribed()
Section titled “isSubscribed()”isSubscribed<
K>(event,listener):boolean
Defined in: packages/async/src/events/event-dispatcher-map-base.ts:38
Check if a callback is subscribed to a specific event.
Type Parameters
Section titled “Type Parameters”K extends string | number | symbol
Parameters
Section titled “Parameters”K
The event name.
listener
Section titled “listener”Callable<Events[K]>
The callback to check.
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”IEventDispatcherMap.isSubscribed
subscribe()
Section titled “subscribe()”subscribe<
K>(event,listener,options?):Callable|null
Defined in: packages/async/src/events/event-dispatcher-map-base.ts:23
Type Parameters
Section titled “Type Parameters”K extends string | number | symbol
Parameters
Section titled “Parameters”K
listener
Section titled “listener”Callable<Events[K]>
options?
Section titled “options?”EventDispatcherSubscribeOptions
Returns
Section titled “Returns”Callable | null
Implementation of
Section titled “Implementation of”unsubscribe()
Section titled “unsubscribe()”unsubscribe<
K>(event,listener):void
Defined in: packages/async/src/events/event-dispatcher-map-base.ts:31
Unsubscribe a callback from a specific event.
Type Parameters
Section titled “Type Parameters”K extends string | number | symbol
Parameters
Section titled “Parameters”K
The event name.
listener
Section titled “listener”Callable<Events[K]>
The callback to remove.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IEventDispatcherMap.unsubscribe
wait()
Section titled “wait()”wait<
K>(event,options?):Promise<Events[K]>
Defined in: packages/async/src/events/event-dispatcher-map-base.ts:45
Wait for the next occurrence of a specific event, optionally matching a predicate.
This is a convenience method that subscribes to the dispatcher, waits for the next event that matches the predicate (if provided), and then unsubscribes automatically.
Type Parameters
Section titled “Type Parameters”K extends string | number | symbol
Parameters
Section titled “Parameters”K
The event name to wait for.
options?
Section titled “options?”EventDispatcherWaitOptions<Events[K]>
Optional settings including predicate and abort signal.
Returns
Section titled “Returns”Promise<Events[K]>
A promise that resolves with the event arguments as an array.