Hierarchical finite state machine for TypeScript and JavaScript
Hierarchical finite state machine for TypeScript and JavaScript
Executable finite state machine for TypeScript and JavaScript.
If you like @steelbreeze/state, please star it...
Note: v8 is now live and contains breaking changes but offers a further simplified code base performance improvements. See the release notes for more information.
Warning: v8 does not yet contain any support for serialization due to the challanges brought by the introduction of deferred events which are cached within the state machine instance alongside the active state configuration.
npm i @steelbreeze/stateThe API is broken up into two distinct parts:
Together, they enable multiple instances of the same state machine model.
The full API reference can be found here.
……The output of the above code will be:
instance enter model
instance enter model.default
instance enter model.default.initial
instance leave model.default.initial
instance enter model.default.stateA
instance evaluate {"fieldA":"test","fieldB":1}
instance evaluate {"fieldA":"test","fieldB":3}
instance leave model.default.stateA
instance enter model.default.stateBNote that in the example above, a default region is inserted as a child of
modeland parent ofinitial,stateAandstateB; the name of default regions copy their parent state hence seeingmodel.modelin the output above.
MIT License
Copyright (c) 2022 David Morris
No open issues yet, or sync has not completed.