b0VIM 7.49W^jbeard4Jacobs-MacBook-Pro.local~jbeard4/workspace/scion/scion/README.mdutf-8 3210#"! Utp59)M[ad 5 H { z f e Z Y ; : 1 0   e ' # "    ^ ] C , +  ]\Nts*)$#v1-, 3. Use SCXML `` element to send SCXML events to web services.2. Script JavaScript object references passed into the SCXML interpreter as event data. This technique is used to script the div DOM node in the drag-and-drop example above. 1. Notify listeners of state changes.An SCXML interpreter has three forms of output:## SCXML Interpreter Output ``` var configuration = scxml.gen({name:"eventName",data:{foo:1}}); //the following call is equivalent var configuration = scxml.gen("eventName",data); var data = {foo:1}; var scxml = new scion.SCXML(model),```javascript`scxml.gen` returns a "basic configuration", which is an Array of strings representing the ids all of the basic states the interpreter is in after the call to `scxml.gen` completes.An SCXML interpreter takes SCXML events as input, where an SCXML event is an object with "name" and "data" properties. These can be passed to method `gen` as two positional arguments, or as a single object.### scxml.gen({name : String, data : Object}) : ``[]### scxml.gen(String eventName, Object eventData) : ``[]Returns a "basic configuration", which is an Array of strings representing the ids all of the basic states the interpreter is in after the call to `scxml.start` completes.`scxml.start` starts the SCXML interpreter. `scxml.start` should only be called once, and should be called before `scxml.gen` is called for the first time.### scxml.start() : ``[]## SCXML Interpreter Input``` scxml2 = new scion.SCXML(model); var scxml1 = new scion.SCXML(model), //same model can be used to create multiple interpreter instances```javascriptThe SCXML constructor creates an interpreter instance from a model object.### new scion.SCXML(model, options)These methods allow you to create an SCXML model from an XML DOM document, document string, or url/path to document.SCION allows you to in })})})})})})})}) interpreter.gen({name:"init",data:rect}); //send the init event interpreter.start(); //start the interpreter var interpreter = new scxml.scion.Statechart(model); //instantiate the interpreter if(err) throw err;scxml.urlToModel("drag-and-drop.xml",function(err,model){```javascript# Quickstart```rhino -modules path/to/SCION/lib -main path/to/your/script.js#just put SCION/lib on your modules path```bashRhino 1.7R3 supports CommonJS modules, so SCION can be used as follows: git clone --recursive git://github.com/jbeard4/SCION.gitGet it with git:## rhino`bower install jbeard4/scion`## browser`npm install scxml`## node.js# Installation- Modular: Specify state machine in SCXML, or pure JSON using [SCION-CORE](https://github.com/jbeard4/SCION-CORE).- Optimized: For performance, memory usage and payload size.- Portable: works well in IE6+, modern browsers, node.js, rhino, and various JavaScript shells. - Persistent: Cheap snapshotting and state machine serialization to secondary storage.- Robust: automatically tested using a [custom testing framework for SCXML implementations](https://github.com/jbeard4/scxml-test-framework). ![Travis-CI build status](https://travis-ci.org/jbeard4/SCION.svg?branch=master)SCION is: SCION provides an implementation of the [W3C SCXML specification](http://www.w3.org/TR/scxml/) in JavaScript. SCXML provides a declarative markup for Statecharts, a powerful modelling language for developing **complex, timed, event-driven, state-based systems**. # OverviewadIMgf k j > = f e $ #   _ ^ Z X E 8 $     I H 4 3 N b)sr`_o('  yIH* [PySCXML](http://code.google.com/p/pyscxml/) * [SCXML Commons](http://commons.apache.org/scxml/)* [SCXML Test Framework](https://github.com/jbeard4/scxml-test-framework)# Related Projects* [Jacob Beard's Master thesis](http://digitool.library.mcgill.ca/R/-?func=dbin-jump-full&object_id=116899&silo_library=GEN01)* [Project Background](https://github.com/jbeard4/SCION/wiki/Project-Background)* [Table describing which SCXML tags are supported](https://github.com/jbeard4/SCION/wiki/SCION-Implementation-Status)* [SCION Demos](https://github.com/jbeard4/scion-demos)* [Action Tag Scripting APIs](https://github.com/jbeard4/SCION/wiki/Action-Tag-Scripting-API)* [Custom Actions](https://github.com/jbeard4/SCION/wiki/Plugin-API-for-SCION-2.0-branch)# Other Resources[Mailing list](https://groups.google.com/group/scion-dev)# Support* Python : [pySCION](https://github.com/jbeard4/pySCION)* C# : [SCION.NET](https://github.com/jbeard4/SCION.NET)* Java : [SCION-Java](https://github.com/jbeard4/SCION-Java)SCION can be used as an embedded state machine interpreter:# Embedding SCION- [Telephony](http://blog.echo-flow.com/2012/07/29/syracuse-student-sandbox-hackathon-recap/)- [IoT Signal Processing](http://www.instructables.com/id/UMEC-Universal-Morse-EncoderDecoder/)- [Interaction Design for the Web](https://github.com/jbeard4/SCION/wiki/SCION-for-Interaction-Design-and-Web-Front-end-Development)# Example Use CasesThe snapshot object can be serialized as JSON and saved to a database. It can later be passed to the SCXML constructor to restore the state machine: `new scion.SCXML(model, {snapshot : snapshot})`.```] dataModel isInFinalState, history, configuration,[```Returns a `snapshot` object, of the form : ### scxml.getSnapshot() : Snapshot Returns true, if the state machine is in a final state. Otherwise, returns false. ### scxml.isFinal() : BooleanReturns true if the state machine is in state with id `stateId`.### scxml.isIn(String : stateId) : BooleanReturns current state machine ***full configuration***, the set of basic states in which the state machine resides, and the hierarchical ancestors of those basic states. ### scxml.getFullConfiguration() : String[]Returns current state machine ***configuration***, the set of basic states in which the state machine resides. ### scxml.getConfiguration() : String[]Furthermore, for the `onTransition` callback, argument `targetStateIds` will be `null` for targetless transitions, rather than, e.g. an empty array.Each `onEntry`, `onExit` and `onTransition` callback is optional - if the property is not present, it will be ignored.Registers a callback to receive notification of state changes, as described above.### scxml.registerListener({onEntry : function(stateId){}, onExit : function(stateId){}, onTransition : function(sourceStateId,[targetStateIds,...]){}})ad9h, F E 7  ~ ] \   _ 3. Use SCXML `` element to send SCXML events to web services.2. Script JavaScript object references passed into the SCXML interpreter as event data. This technique is used to script the div DOM node in the drag-and-drop example above. 1. Notify listeners of state changes.An SCXML interpreter has three forms of output:## SCXML Interpreter Output ``` var configuration = scxml.gen({name:"eventName",data:{foo:1}}); //the following call is equivalent var configuration = scxml.gen("eventName",data); var data = {foo:1}; var scxml = new scion.SCXML(model),```javascript`scxml.gen` returns a "basic configuration", which is an Array of strings representing the ids all of the basic states the interpreter is in after the call to `scxml.gen` completes.An SCXML interpreter takes SCXML events as input, where an SCXML event is an object with "name" and "data" properties. These can be passed to method `gen` as two positional arguments, or as a single object.### scxml.gen({name : String, data : Object}) : ``[]### scxml.gen(String eventName, Object eventData) : ``[]Returns a "basic configuration", which is an Array of strings representing the ids all of the basic states the interpreter is in after the call to `scxml.start` completes.`scxml.start` starts the SCXML interpreter. `scxml.start` should only be called once, and should be called before `scxml.gen` is called for the first time.### scxml.start() : ``[]## SCXML Interpreter Input``` scxml2 = new scion.SCXML(model); var scxml1 = new scion.SCXML(model), //same model can be used to create multiple interpreter instances```javascriptThe SCXML constructor creates an interpreter instance from a model object.### new scion.SCXML(model, options)These methods allow you to create an SCXML model from an XML DOM document, document string, or url/path to document.SCION allows you to instantiate SCXML interpreters from SCXML "model" objects, which are SCXML documents that have been processed for easier interpretation. ### scion.documentToModel(scxmlDocument,function(err, model){}[, context])### scion.documentStringToModel(scxmlDocString,function(err, model){}[, context])### scion.pathToModel(path,function(err, model){}[, context])### scion.urlToModel(url,function(err, model){}[, context])## Instantiation# API```