A fluent JavaScript State Machine with full TypeScript support
Install package
npm i @2toad/fluent-state
import { fluentState } from '@2toad/fluent-state';
// or
const { fluentState } = require('@2toad/fluent-state');
fluentState
.from('vegetable').to('diced').or('pickled')
.from('diced').to('salad').or('trash');
fluentState
.when('diced').do(() => console.log('diced'));
// Perform transition
await fluentState.transition('diced');
// or
await fluentState.next();
- API
- Fluent State is a non-hierarchial state machine. For more information on its architecture and how it operates, please refer to the State Machine documentation.
- Fluent State has a flexible plugin architecture. See the Plugins documentation for more details.
So you want to contribute to the Fluent State project? Fantastic! Please read the Contribute doc to get started.