Create a new TypedStateMachine
The configuration such as transition functions and initial state
The initial configuration
Indicate if the current instance is initialized or not
Indicate is a transition is pending
The current internal state
Mark the _isTransitionPending to true
Mark the _isTransitionPending to false
Changes the state of the machine
The transition that eventually contains the hooks to invoke
The new state to reach
The options to ignore hooks or events
Add a new hook handler in the specified state and hook type.
If an hook already exist with the same combination of state and hookType it will be replaced.
The state associated to this hook
The hook type
The executed handler
If the transition from the current state is not possible return false, true otherwise.
The destination state
Return all the state of the machine with an extra indicator that indicates if they are reachable from current state
Return all the current transition functions
Return the current configuration of the machine
Returns the states that are reachable from the current state
Return the current internal state of the machine.
Throws an error if there is a pending transition
Return a transition from the current state to the newState, if it exists.
Return null if the transition does not exist
The new state
Perform a transition from the current state to the given new state (without checking at the given transitions).
During this transition all life cycles events will be triggered.
The destination state
Initialize the machine with the initial state and invokes the registered hooks
Execute the first hook that matches the target state and the hookType
The state of which you want to execute the hook
The hook type that you want to execute
Return true if the transition to the target state is a self loop from the current state or not.
The target state
Throw if this instance is not initialized
Perform a transition from the current state to the given new state, if possible. If the transition is not possible return false, true if the transition succeeded.
Lifecycle events:
During this transition all life cycles events will be triggered.
The destination state
Make a transition from the current state to the first applicable state of the transition with the specified name.
If multiple transition have the same name, the first applicable state is is picked up traversing transitions in order of declaration.
If the transition has an array in "to" the first applicable state is is picked up.
The target transition name
Overwrite the given configuration.
Update only specified properties.
The new configuration properties to overwrite
The default transit options
Generated using TypeDoc
A strongly typed state machine inspired by finite-state-machine