2.0.1 • Published 9 years ago

tiny-sm v2.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

TinySM

A tiny state machine that doesn't worry about where you came from or where you're going.

Installation

$ npm install tiny-sm

Example Usage

let sm1 = new TinySM({
  foo: (x) => console.log(x)
});

sm1.to("foo", 42);
// 42


let sm2 = new TinySM({
  foo: {
    enter: () => console.log("Entering foo."),
    exit:  () => console.log("Exiting foo.")
  },
  bar: () => console.log("Entering bar.")
});

sm2.to("foo");
// "Entering foo."

sm2.to("bar");
// "Exiting foo."
// "Entering bar."

sm2.to("foo");
// "Entering foo."
2.0.1

9 years ago

2.0.0

9 years ago

1.0.2

9 years ago

1.0.1

10 years ago

1.0.0

10 years ago