Fork me on GitHub

The following defines a state machine with a single state (HelloWorld) that prints 'hello world' and then exits.

function helloWorld (fire) {
  this.startState = 'HelloWorld';
  this.states = {
    HelloWorld: {
      entry: function () {
        console.log('hello world');
        return '@exit';
      }
    }
  };
};

module.exports = helloWorld;

Example Output

The source code for the example can be found in the file examples/hello_world.js and run using the ignite command line helper application as follows:

 $ ./bin/ignite examples/hello_world.js
 Running examples/hello_world.js
 hello world
 run: examples/hello_world.js Exited with no error.
 $ _