@yantrix/automata v0.2.0 • Docs
Yantrix API / @yantrix/automata / TAutomataEventHandler
Type Alias: TAutomataEventHandler()<EventType, ActionType, EventMetaType, PayloadType>
ts
type TAutomataEventHandler<EventType, ActionType, EventMetaType, PayloadType>: (event) => TAutomataActionPayload<ActionType, PayloadType>;Represents an event handler function for an automata.
Type Parameters
• EventType extends TAutomataBaseEventType
The type of the automata event.
• ActionType extends TAutomataBaseActionType
The type of the automata action.
• EventMetaType extends { [K in EventType]: any } = Record<EventType, any>
The type of the metadata associated with each event.
• PayloadType extends { [K in ActionType]: any } = Record<ActionType, any>
The type of the payload associated with each action.
Parameters
• event: TAutomataEventMetaType<EventType, EventMetaType>
The event metadata.
Returns
TAutomataActionPayload<ActionType, PayloadType>
The action(and its payload) that needs to be dispatched to the automata upon processing the event.