Create a connection state machine.
A new ConnectionStateMachine instance
import { createConnectionStateMachine } from './connection/state.js';const stateMachine = createConnectionStateMachine();stateMachine.onStateChange((event) => { console.log(`State: ${event.previousState} -> ${event.newState}`);});stateMachine.transition('connecting'); Copy
import { createConnectionStateMachine } from './connection/state.js';const stateMachine = createConnectionStateMachine();stateMachine.onStateChange((event) => { console.log(`State: ${event.previousState} -> ${event.newState}`);});stateMachine.transition('connecting');
Create a connection state machine.