Examples
Three worked machines, each adding one idea. They use only @statewalker/fsm — no framework, no build step — and every one runs live on its page.
-
Light Bulb — the smallest useful machine: two states and a
toggleevent. Start here to see the engine and its lifecycle hooks with nothing else in the way. -
Traffic Light — a cyclic machine that drives itself. It shows how a state can yield timed events through a generator so the machine advances on its own.
-
Coffee Machine — a hierarchical machine: nested states, an interactive statechart, and events that bubble from a leaf up to a parent.
Each page shows the configuration, a live statechart, and the code that wires behaviour to states. For the concepts behind them, read States, Events & Transitions and Hierarchy & Lifecycle.