Created
May 21, 2018 19:57
-
-
Save mogsie/1f155877db6e93b3463df8bc314b7e8d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const scxml = require('scxml'); | |
scxml.pathToModel("transient.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 | |
console.log(sc.gen({name:"E"})); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<scxml xmlns="http://www.w3.org/2005/07/scxml" | |
version="1.0" | |
profile="ecmascript" | |
id="root" | |
initial="m"> | |
<parallel id="m"> | |
<state id="A"> | |
<state id="A1"> | |
<transition event="E" target="A2"/> | |
</state> | |
<state id="A2"> | |
<onentry> | |
<raise event="INT1"/> | |
</onentry> | |
</state> | |
</state> | |
<state id="B"> | |
<state id="B1"> | |
<transition event="E" target="B2"/> | |
</state> | |
<state id="B2"> | |
<onentry> | |
<raise event="INT2"/> | |
</onentry> | |
</state> | |
</state> | |
<state id="C"> | |
<state id="C1"> | |
<transition event="INT1" target="C2"/> | |
<transition event="INT2" target="C3"/> | |
</state> | |
<state id="C2"> | |
<transition event="INT2" target="C4"/> | |
</state> | |
<state id="C3"> | |
<transition event="INT1" target="C4"/> | |
</state> | |
<state id="C4"> | |
</state> | |
</state> | |
</parallel> | |
</scxml> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment