Simple full-featured finite state machine for your project
- ๐ฏ 333 LOC - 0 dependencies
- ๐ Sophisticated object-oriented design
import { StateMachineBuilder } from "it-fsm";
const [locked, unlocked] = ["locked", "unlocked"] as const;
const sm = new StateMachineBuilder()
.withStates([locked, unlocked])
.withTransitions([
[locked, { coin: unlocked }],
[unlocked, { push: locked }],
])
.build(locked);
You can find more examples here
if you use the Deno, just add the following to your
import_map.json
{
"imports": {
"it-fsm": "https://git.pleshevski.ru/pleshevskiy/it-fsm/raw/tag/v2.0.3/fsm.ts"
}
}
If you use the Node.js or in a browser as ES module, you may need to install it as follows, and additionally you can add import maps for client side.
npm install --save it-fsm
GNU General Public License v3.0 or later
See COPYING to see the full text.