UNPKG

johnny-five

Version:

The JavaScript Arduino Programming Framework.

53 lines (42 loc) 939 B
var lodash = require("lodash"); var machina = require("machina")(lodash); // var Scanner = new machina.Fsm({ // initialState: "notScanning", // states: { // notScanning: { // start: function(data) { // console.log( data ); // console.log( "notScanning start" ); // } // }, // scanning: { // start: function(data) { // console.log( data ); // console.log( "notScanning start" ); // } // } // } // }); // Scanner. var transitioned = false; var fsm = new machina.Fsm( { initialState : "notstarted", states : { notstarted : { "start" : "started" }, started : { _onEnter : function () { console.log( "message" ); transitioned = true; } } } }); fsm.handle( "start" ); console.log( transitioned ); setInterval(function() { console.log( fsm ); fsm.handle( "start" ); }, 500); // Doug Neiner slides?