ts

tiny-sm

A tiny JavaScript state machine

Showing:

Popularity

Downloads/wk

5

GitHub Stars

2

Maintenance

Last Commit

6yrs ago

Contributors

2

Package

Dependencies

0

Size (min+gzip)

0.4KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

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."

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100