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.
npm install scxml
Add the following script tags to your HTML:
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.23.0/polyfill.min.js">
<script src="https://cdnjs.cloudflare.com/ajax/libs/scion/4.3.1/scxml.min.js">
Then SCION API available as global singleton object scxml
.
Install babel-polyfill and scxml with npm:
npm install --save scxml babel-polyfill
Then add to your application entry point:
require('babel-polyfill');
let scxml = require('scxml');
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});
});
})
See the API docs here.
See the note here.
This project exists thanks to all the people who contribute.
Thank you to all our backers! 🙏 [Become a backer]
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]
To report a bug: file an issue on GitHub.