The initial state when the state machine is initialized. This state will be set when the FSM reaches its configured lifecycle phase.
State machine definition mapping states to their allowed transitions.
states: {
idle: { on: { PREPARE: 'preparing' } },
preparing: { on: { READY: 'ready', ERROR: 'error' } },
ready: { on: { POUR: 'pouring' } },
pouring: { on: { COMPLETE: 'idle', ERROR: 'error' } },
error: { on: { RESET: 'idle' } }
}
Optional initializeThe lifecycle phase at which the state machine should be initialized. Before this phase, currentState will be undefined and isFsmInitialized will be false.
DependencyLifecycle.READY
// FSM initializes when model is ready (most common)
initializeAt: DependencyLifecycle.READY
// FSM initializes only when UI activates the model
initializeAt: DependencyLifecycle.ACTIVATE
// FSM initializes during model initialization (rare)
initializeAt: DependencyLifecycle.INIT
Configuration for a KOS state machine.
Example