Simple full-featured finite state machine for your project
|
||
---|---|---|
src | ||
tests | ||
.gitignore | ||
.travis.yml | ||
jest.config.js | ||
LICENSE | ||
package-lock.json | ||
package.json | ||
README.md | ||
tsconfig.json |
IT FSM
Simple finite state machine
Installation
npm install --save it-fsm
Usage
import { StateMachine } from 'it-fsm';
const fsm = new StateMachine('TODO', {
TODO: {
complete: 'COMPLETE'
}
})
if (fsm.can('complete')) {
fsm.complete().then(() => {
})
}
// or
if (fsm.canToState('COMPLETE')) {
fsm.complete().then(() => {
});
}