This repository was archived by the owner on Nov 12, 2025. It is now read-only.
v0.2.0
Added support for event payloads.
const stateMachine = StateMachine
.configure()
.initialState('state1')
.on('eventA').transitionTo('state2').withAction((fromState, toState, context) => {
// Do something with the payload
console.log('Payload:', context.eventPayload);
})
.start();
// Send an event with a payload
stateMachine.handle('eventA', { foo: 'bar' });