Napoleonic Panda Machine

statum

0.1.2 • Public • Published

Statum

Simple state machines

var Statum = require('statum');
 
var time = new Statum(function() { return new Date(); });
setInterval(time.refresh, 1000);
 
function isAfterNoon(time) { return time.getHours() > 12; }
 
time
  .change(isAfterNoon, function() { })
  .enter(isAfterNoon, function() { })
  .exit(isAfterNoon, function() { });
 
time.state(isAfterNoon, {
  change: function() {},
  enter: function() {},
  exit: function() {}
});
 
time.state(isAfterNoon, function() {}, function() {});
 
time.off(isAfterNoon);

install

npm i statum

Downloadsweekly downloads

18

version

0.1.2

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability