Variable StateMachineConst

StateMachine: StateMachineConstructor = ...

Creates a new state machine.

Param

State machine parameters.

Param

State machine id. Used in error messages.

Param

Initial state.

Param

Context object.

Param

Transitions.

Param

From state.

Param

From states.

Param

Event name.

Param

To state.

Param

Callback to execute on enter.

Param

Callback to execute on exit.

Param

Guard function.

Example

const stateMachine = new StateMachine({
id: '1',
initial: State.idle,
transitions: [
t(State.idle, Event.fetch, State.pending),
t(State.pending, Event.resolve, State.idle),
],
});

Returns

New state machine.

Generated using TypeDoc