<script src="SCION/dist/scxml.js" type="text/javascript"></script>
scxml.urlToModel("sfm-coach.xml", function(err, model) {
if (err) { throw err; }
// instantiate the interpreter
var interpreter = new scxml.scion.Statechart(model);
interpreter.registerListener(listeners);
// start the interpreter
interpreter.start();
interpreter.gen({
name : "init",
data : api
});
});
--
You received this message because you are subscribed to the Google Groups "scion-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scion-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
$(document).ready(function()
{
var $wnd = window;
var api = null;
var listeners = {
onEntry: function(stateId) { console.log('entering state ' + stateId); },
onExit: function(stateId) { console.log('exiting state ' + stateId); },
onTransition: function(sourceStateId, targetIds) {
if (targetIds && targetIds.length) {
console.log('transitioning from ' + sourceStateId + ' to ' + targetIds.join(','));
} else {
console.log('executing target-less transition in ' + sourceStateId);
}
},
onError: function(err) {
console.log('ERROR:' + JSON.stringify(err));
}
};
scxml.urlToModel("sfm-coach.xml", function(err, model)
{
if (err)
{
throw err;
}
api = {
jQuery : function()
{
return jQuery;
},
window : function()
{
return window;
}
};
// instantiate the interpreter
var interpreter = new scxml.scion.Statechart(model);
interpreter.registerListener(listeners);
// start the interpreter
interpreter.start();
interpreter.gen({
name : "init",
data : api
});
});
});
{
key: 'registerListener',
value: function registerListener(listener) {
BaseInterpreter.EVENTS.forEach(function (event) {
if (listener[event]) this.on(event, listener[event]);
}, this);
}
/** @expose */registerListener:
function registerListener(listener){BaseInterpreter.EVENTS.forEach(function(event){
if(listener[event])this.on(event,listener[event]);});}
,
Hi Jacob,It looks like the /this/ is now passed as the 2nd argument to FOREACH() when using