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);

Package Sidebar

Install

npm i statum

Weekly Downloads

2

Version

0.1.2

License

MIT

Last publish

Collaborators

  • krambuhl