Skip to content
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
examples
lib
spec
.project
LICENSE
README
Rakefile
fsm.js

README

JavaScript Finite State Machine Builder
======================================= 

Version 0.2, 2007-12-30

This script embeds in JavaScript a domain-specific language 
-- a fluent interface, really -- for describing and building
simple finite state machines.

See the source code of spec/fsm.html and the files in examples
for how it is supposed to work.

Here's just a quick motivational example:

var Machine = FSM.build(function(fsm) { with (fsm) {
  onUnexpectedEvent(function() { ... });

  state('start', 'initial')
    .event('go')
      .goesTo('middle')
      .doing(function() { ... })
      .doing('phew')
    .event('run')
      .goesTo('finish')
    .onExiting(function() { ... });

  state('middle')
    .onUnexpectedEvent(function() { ... })
    .onEntering(function() { ... })
    .event('back')
      .goesTo('start')
      .onlyIf(function() { return true_or_false })
    .event('go')
      .goesTo('finish');

  state('finish', 'final');
}});

function TestMachine() {}
// amend TestMachine.prototype here all the way you want
TestMachine.prototype.phew = function() { ... };
TestMachine.prototype = new Machine(TestMachine.prototype);


== Changes

=== 0.2.2 (2007-12-30)
Include examples in dist.

=== 0.2.1 (2007-12-30)
Corrected version in Rakefile.

=== 0.2 (2007-12-30)
- Accessors for successorStates and expectedEvents
- Machine-global onEntering, onExiting actions
- Drag & Drop example

=== 0.1.1 (2007-12-23)
Add FSM.build() as suggested by Nicolás Sanguinetti.

=== 0.1 (2007-12-22)
First release.

Copyright (c) 2007, Michael Schuerig, michael@schuerig.de
Something went wrong with that request. Please try again.