Skip to content
Simple state machines
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
tests
.gitignore
.jshintrc
.npmignore
LICENSE
README.md
index.js
package.json

README.md

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);
You can’t perform that action at this time.