Constructor, requires an initial state.
The initial state for this machine.
Machine inputs.
The active state machine program.
The state at program exit. Returns undefined
unless the program has ended.
Call this from any action to signal program completion.
The exit state to
return from .run.
Combine this machine with a new one. (warning: shared variables in state
may cause emergent behaviour, calls to exit()
from one machine may abort
early for the other)
Other machine to combine with.
Which machine takes precedence when there's a conflict in state variables. Defaults to 'this'.
A combined state to use for the new machine, or a custom function to combine the states. You may supply a string {'current'|'initial'} to perform automatic conversion. Defaults to 'current'.
A hybrid event machine exhibiting the behaviour of both parents.
Resets the state machine to the initial state.
(optional) Restart with a different initial state.
A blocking call that evaluates the state machine until it exits.
Should we keep going even if the machine stops reacting?
Returns the machine's exit state, or null if the machine halted.
Advance a single tick and return.
Number of actions fired during this tick.
Generated using TypeDoc
Your state machine should inherit the
StateMachine<YourStateInterface>
class.