Skip to content

@yantrix/automata v0.2.0Docs


Yantrix API / @yantrix/automata / TEventBusHandler

Type Alias: TEventBusHandler()<EventType, EventMetaType>

ts
type TEventBusHandler<EventType, EventMetaType>: (event) => TEventBusTask<EventType, EventMetaType>;

Handler function for the event bus that transforms emitted events to event bus tasks. Contains the ID of this task, as well as Promise for next events to be processed. Returning null as a result of handler makes it synchronous.

Type Parameters

EventType extends TAutomataBaseEventType

The type of the automata event.

EventMetaType extends { [K in EventType]: any } = Record<EventType, any>

The type of the metadata associated with each event.

Parameters

event: TAutomataEventMetaType<EventType, EventMetaType>

The event metadata.

Returns

TEventBusTask<EventType, EventMetaType>

The event bus task.