Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Create simple finite state machines
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
specs
src
.gitignore
.jshintrc
.travis.yml
Gruntfile.js
README.md
bower.json
package.json

README.md

Build Status endorse

simple-fsm

Create simple finite state machines

Nodejs

Installation

$ npm install simple-fsm --save

Usage

var fsm = require('simple-fsm');
var machine = fsm.create({
    OFF:{ toggle: function(){ this.ON(); } },
    ON:{ toggle: function(){ this.OFF(); } }
}).OFF(); // set the initial state to OFF

Browser

Installation (bower)

$ bower install simple-fsm --save

Usage

<script src="bower_components/simple-fsm/src/simple-fsm.js"></script>
<script>
    var machine = fsm.create({
        OFF:{ toggle: function(){ this.ON(); } },
        ON:{ toggle: function(){ this.OFF(); } }
    }).OFF(); // set the initial state to OFF
</script>
Something went wrong with that request. Please try again.