Lightweight state machines in TypeScript, powered by tagged unions and mapped types.
- State Machines:
- Strongly-typed machines, states, events and api
states
may have typed payloads, events may have typed parameters- Powerful and flexible
transitions
configuration with typed parameters and exit states- receive event with all parameters
- transition by name OR use transition functions for full control
send
and strongly typedevent
api accept typed event and payload args
- Tagged Unions: powerful, elegant
matchbox
factories for states, events and effects - Async: use promise handler and promise machine for bulletproof async
- Extensibility: composable setup, enhancers, hooks, lifecycle
- Extras: effects, subscribe, when, reset
- Integrations: React
Greatly inspired by:
Published under MIT License.