Statecharts.sh Documentation
Welcome to the statecharts.sh documentation.
Statecharts.sh is a TypeScript-first library for building statecharts — an extension of finite state machines with hierarchy, concurrency, and communication.
Quick Start
Section titled “Quick Start”npm install statecharts.shimport { chart } from "statecharts.sh";
const trafficLight = chart({ context: {}, initial: "red", states: { red: { on: { TIMER: "green" } }, green: { on: { TIMER: "yellow" } }, yellow: { on: { TIMER: "red" } }, },});
const instance = trafficLight.start();instance.send("TIMER"); // → greenSections
Section titled “Sections”- Getting Started — Installation and basic usage
- API Reference — Detailed API documentation
- Examples — Real-world patterns and recipes