it-fsm/README.md

683 B

IT FSM

Simple finite state machine

Build Status Coverage Status

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(() => {
    
  });
}