node package manager

scxml

An implementation of SCXML in JavaScript.

Overview

SCION is an industrial-strength implementation of W3C SCXML in JavaScript.

SCXML provides a declarative markup for Statecharts, a powerful modelling language for developing complex, timed, event-driven, state-based systems.

Installation

npm install scxml

bower install jbeard4/scion

Or add:

<script src="https://cdnjs.cloudflare.com/ajax/libs/scion/3.0.0/scion-min.js">

Quickstart

scxml.urlToModel("drag-and-drop.xml",function(err,model){
 
  if(err) throw err;
 
  model.prepare(function(err, fnModel) {
 
    if(err) throw err;
 
    //instantiate the interpreter 
    var sc = new scxml.scion.Statechart(fnModel);
 
    //start the interpreter 
    sc.start();
 
    //send the init event 
    sc.gen({name:"init",data:rect});
 
  });
})

API

Compile SCXML to JavaScript object "model".

Prepare the model by downloading source scripts and constructing a host execution context for the SCXML datamodel.

The Statechart constructor creates an interpreter instance from a model object.

    //same model can be used to create multiple interpreter instances 
    var sc1 = new scxml.scion.Statechart(fnModel),
        sc2 = new scxml.scion.Statechart(fnModel);

See SCION-CORE API.

Build Status