Skip to content

Latest commit

 

History

History
18 lines (15 loc) · 495 Bytes

initialization.md

File metadata and controls

18 lines (15 loc) · 495 Bytes

Initialization Options

Implicit Init Transition

You must specify the name of your initial state, when initilizing, an init transition will be fired (along with appropriate lifecycle events) when the state machine is constructed.

const fsm = new StateMachine({
  init: 'A',
  transitions: [
    { name: 'step', from: 'A', to: 'B' },
    { name: 'step', from: 'B', to: 'C' },
  ],
}) // 'init()' transition fires from 'none' to 'A' during construction
fsm.state // 'A'