simple-fsm

Create simple finite state machines

simple-fsm

Create simple finite state machines

$ npm install simple-fsm --save
var fsm = require('simple-fsm');
var machine = fsm.create({
OFF:{ togglefunction(){ this.ON(); } },
ON:{ togglefunction(){ this.OFF(); } }
}).OFF(); // set the initial state to OFF 

Installation (bower)

$ bower install simple-fsm --save
<script src="bower_components/simple-fsm/src/simple-fsm.js"></script>
<script>
var machine = fsm.create({
OFF:{ togglefunction(){ this.ON(); } },
ON:{ togglefunction(){ this.OFF(); } }
}).OFF(); // set the initial state to OFF
</script>