Skip to content

@yantrix/automata v0.0.2Docs


Yantrix API / @yantrix/automata / TAutomataEventEmitter

Type Alias: TAutomataEventEmitter()<EventType, StateType, EventMetaType, ContextType>

ts
type TAutomataEventEmitter<EventType, StateType, EventMetaType, ContextType>: (state) => TAutomataEventMetaType<EventType, EventMetaType>;

Represents an event emitter function for an automata.

Type Parameters

EventType extends TAutomataBaseEventType

The type of the automata event.

StateType extends TAutomataBaseStateType

The type of the automata state.

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

The type of the metadata associated with each event.

ContextType extends { [K in StateType]: any } = Record<StateType, any>

The type of the context associated with each state.

Parameters

state: TAutomataStateContext<StateType, ContextType>

The current state of the automata.

Returns

TAutomataEventMetaType<EventType, EventMetaType>

The event that needs to be emitted by the automata after executing a certain Action.