scion-core
Advanced tools
Comparing version 1.2.1 to 1.3.2
{ | ||
"name": "scion-core", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"author": { | ||
@@ -5,0 +5,0 @@ "name": "Jacob Beard", |
@@ -560,27 +560,34 @@ (function (global, factory) { | ||
var scxmlPrefixTransitionSelector = function () { | ||
var RX_TRAILING_WILDCARD = /\.\*$/; | ||
var eventNameReCache = {}; | ||
function isEventPrefixMatch(prefix, fullName) { | ||
prefix = prefix.replace(RX_TRAILING_WILDCARD, ''); | ||
function eventNameToRe(name) { | ||
return new RegExp("^" + name.replace(/\./g, "\\.") + "(\\.[0-9a-zA-Z]+)*$"); | ||
if (prefix === fullName) { | ||
return true; | ||
} | ||
function retrieveEventRe(name) { | ||
return eventNameReCache[name] ? eventNameReCache[name] : eventNameReCache[name] = eventNameToRe(name); | ||
if (prefix.length > fullName.length) { | ||
return false; | ||
} | ||
function nameMatch(t, event) { | ||
return event && event.name && (t.events.indexOf("*") > -1 ? true : t.events.filter(function (tEvent) { | ||
return retrieveEventRe(tEvent).test(event.name); | ||
}).length); | ||
if (fullName.charAt(prefix.length) !== '.') { | ||
return false; | ||
} | ||
return function (state, event, evaluator) { | ||
return state.transitions.filter(function (t) { | ||
return (!t.events || nameMatch(t, event)) && (!t.cond || evaluator(t.cond)); | ||
}); | ||
}; | ||
}(); | ||
return fullName.indexOf(prefix) === 0; | ||
} | ||
function isTransitionMatch(t, eventName) { | ||
return t.events.some(function (tEvent) { | ||
return tEvent === '*' || isEventPrefixMatch(tEvent, eventName); | ||
}); | ||
} | ||
function scxmlPrefixTransitionSelector(state, event, evaluator) { | ||
return state.transitions.filter(function (t) { | ||
return (!t.events || event && event.name && isTransitionMatch(t, event.name)) && (!t.cond || evaluator(t.cond)); | ||
}); | ||
} | ||
//model accessor functions | ||
@@ -926,3 +933,3 @@ var query = { | ||
this.emit('onTransition', transition.source.id, targetIds); | ||
this.emit('onTransition', transition.source.id, targetIds, stxIdx); | ||
@@ -1133,5 +1140,3 @@ if (transition.onTransition !== undefined) { | ||
var usePrefixMatchingAlgorithm = currentEvent && currentEvent.name && currentEvent.name.search("."); | ||
var transitionSelector = usePrefixMatchingAlgorithm ? scxmlPrefixTransitionSelector : this.opts.transitionSelector; | ||
var transitionSelector = this.opts.transitionSelector; | ||
var enabledTransitions = new this.opts.Set(); | ||
@@ -1138,0 +1143,0 @@ |
@@ -1,2 +0,2 @@ | ||
/*! scion-core 2016-07-30 */ | ||
!function(a,b){if("function"==typeof define&&define.amd)define(["module"],b);else if("undefined"!=typeof exports)b(module);else{var c={exports:{}};b(c),a.scion=c.exports}}(this,function(a){"use strict";function b(a){return a.targets}function c(a,b){return b.depth-a.depth}function d(a,b){return a.depth-b.depth}function e(a,b){return a.documentOrder-b.documentOrder}function f(a){function b(a){void 0===m[a]&&(m[a]=0);var b=m[a]++;return"$generated-"+a+"-"+b}function c(a){return{$deserializeDatamodel:a.$deserializeDatamodel||function(){},$serializeDatamodel:a.$serializeDatamodel||function(){return null},$idToStateMap:k,states:[{$type:"initial",transitions:[{target:a}]},a]}}function d(a,c){if(c.transitions&&j.push.apply(j,c.transitions),c.id){if(k.has(c.id))throw new Error("Redefinition of state id "+c.id);k.set(c.id,c)}c.$type=c.$type||"state",c.ancestors=a,c.depth=a.length,c.parent=a[0],c.transitions=c.transitions||[];for(var f=0,g=c.transitions.length;f<g;f++){var h=c.transitions[f];h.documentOrder=l++,h.source=c}if(c.states)for(var i=[c].concat(a),f=0,g=c.states.length;f<g;f++)d(i,c.states[f]);switch(c.$type){case"parallel":c.typeEnum=t.PARALLEL;break;case"initial":c.typeEnum=t.INITIAL;break;case"history":c.typeEnum=t.HISTORY;break;case"final":c.typeEnum=t.FINAL;break;case"state":case"scxml":c.states&&c.states.length?c.typeEnum=t.COMPOSITE:c.typeEnum=t.BASIC;break;default:throw new Error("Unknown state type: "+c.$type)}c.states?c.descendants=c.states.concat(c.states.map(function(a){return a.descendants}).reduce(function(a,b){return a.concat(b)},[])):c.descendants=[];var m;if(c.typeEnum===t.COMPOSITE&&("string"==typeof c.initial?n.push(c):(m=c.states.filter(function(a){return"initial"===a.$type}),c.initialRef=m.length?m[0]:c.states[0],e(c))),c.typeEnum===t.COMPOSITE||c.typeEnum===t.PARALLEL){var o=c.states.filter(function(a){return"history"===a.$type});c.historyRef=o[0]}c.id||(c.id=b(c.$type),k.set(c.id,c)),c.onEntry&&!Array.isArray(c.onEntry)&&(c.onEntry=[c.onEntry]),c.onExit&&!Array.isArray(c.onExit)&&(c.onExit=[c.onExit])}function e(a){if(!a.initialRef)throw new Error("Unable to locate initial state for composite state: "+a.id)}function f(){for(var a=0,b=n.length;a<b;a++){var c=n[a];c.initialRef=k.get(c.initial),e(c)}}function g(){for(var a=0,b=j.length;a<b;a++){var c=j[a];if(c.onTransition&&!Array.isArray(c.onTransition)&&(c.onTransition=[c.onTransition]),"string"==typeof c.event&&(c.events=c.event.trim().split(o)),delete c.event,!c.targets&&"undefined"!=typeof c.target)if("string"==typeof c.target){var d=k.get(c.target);if(!d)throw new Error("Unable to find target state with id "+c.target);c.target=d,c.targets=[c.target]}else if(Array.isArray(c.target))c.targets=c.target.map(function(a){if("string"==typeof a){if(a=k.get(a),!a)throw new Error("Unable to find target state with id "+c.target);return a}return a});else{if("object"!==r(c.target))throw new Error("Transition target has unknown type: "+c.target);c.targets=[c.target]}}for(var a=0,b=j.length;a<b;a++){var c=j[a];c.targets&&(c.lcca=i(c.source,c.targets[0])),c.scope=h(c)}}function h(a){var b="internal"===a.type&&a.source.parent&&a.targets&&a.targets.every(function(b){return a.source.descendants.indexOf(b)>-1});return a.targets?b?a.source:a.lcca:a.source}function i(a,b){for(var c=[],d=0,e=a.ancestors.length;d<e;d++){var f=a.ancestors[d];f.typeEnum===t.COMPOSITE&&f.descendants.indexOf(b)>-1&&c.push(f)}if(!c.length)throw new Error("Could not find LCA for states.");return c[0]}var j=[],k=new Map,l=0,m={},n=[],o=/\s+/,p=c(a);return d([],p),g(),f(),p}function g(){this._listeners={},this._listeners["*"]=[]}function h(a){a=a||[],this.o=new Set(a)}function i(a){var b=a[0],c=a[1];return b.source.depth<c.source.depth?c:c.source.depth<b.source.depth?b:b.documentOrder<c.documentOrder?b:c}function j(a,b,c){return b.x=b.x||{},a.call(c,b.x,b.sessionid,b.ioprocessors,c.isIn.bind(c))}function k(a,b){return a.map(function(a){var c=b.get(a);if(!c)throw new Error("Error loading serialized configuration. Unable to locate state with id "+a);return c})}function l(a,b){var c={};return Object.keys(a).forEach(function(d){c[d]=a[d].map(function(a){var c=b.get(a);if(!c)throw new Error("Error loading serialized history. Unable to locate state with id "+a);return c})}),c}function m(a,b){g.call(this),this._scriptingContext=b.interpreterScriptingContext||(b.InterpreterScriptingContext?new b.InterpreterScriptingContext(this):{});var c;c="function"==typeof a?j(a,b,this):"string"==typeof a?JSON.parse(a):a,this._model=f(c),this.opts=b||{},this.opts.console=b.console||("undefined"==typeof console?{log:function(){}}:console),this.opts.Set=this.opts.Set||h,this.opts.priorityComparisonFn=this.opts.priorityComparisonFn||i,this.opts.transitionSelector=this.opts.transitionSelector||v,this._scriptingContext.log=this._scriptingContext.log||function(){this.opts.console.log.apply?this.opts.console.log.apply(this.opts.console,arguments):this.opts.console.log(Array.prototype.slice.apply(arguments).join(","))}.bind(this),this._internalEventQueue=[],b.snapshot?(this._configuration=new this.opts.Set(k(b.snapshot[0],this._model.$idToStateMap)),this._historyValue=l(b.snapshot[1],this._model.$idToStateMap),this._isInFinalState=b.snapshot[2],this._model.$deserializeDatamodel(b.snapshot[3])):(this._configuration=new this.opts.Set,this._historyValue={},this._isInFinalState=!1),this._x={_sessionId:b.sessionId||null,_name:c.name||b.name||null,_ioprocessors:b.ioprocessors||null}}function n(a,b){b=b||{},b.ioprocessors={};for(var c in u)b.ioprocessors[c]=u[c];b.InterpreterScriptingContext=b.InterpreterScriptingContext||q,this._isStepping=!1,m.call(this,a,b)}function o(a){function b(){}return b.prototype=a,new b}function p(){}function q(a){this._interpreter=a,this._timeoutMap={}}var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol?"symbol":typeof a},s=Object.assign||function(a,b){return Object.keys(b).forEach(function(c){a[c]=b[c]}),a},t={BASIC:0,COMPOSITE:1,PARALLEL:2,HISTORY:3,INITIAL:4,FINAL:5},u={scxml:{location:"http://www.w3.org/TR/scxml/#SCXMLEventProcessor"},basichttp:{location:"http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"},dom:{location:"http://www.w3.org/TR/scxml/#DOMEventProcessor"},publish:{location:"https://github.com/jbeard4/SCION#publish"}};g.prototype.on=function(a,b){return Array.isArray(this._listeners[a])||(this._listeners[a]=[]),this._listeners[a].indexOf(b)===-1&&this._listeners[a].push(b),this},g.prototype.once=function(a,b){function c(){for(var e=[],f=0;f<arguments.length;f+=1)e[f]=arguments[f];d.off(a,c),b.apply(d,e)}var d=this;return c.listener=b,this.on(a,c)},g.prototype.off=function(a,b){if(!Array.isArray(this._listeners[a]))return this;if("undefined"==typeof b)return this._listeners[a]=[],this;var c=this._listeners[a].indexOf(b);if(c===-1)for(var d=0;d<this._listeners[a].length;d+=1)if(this._listeners[a][d].listener===b){c=d;break}return this._listeners[a].splice(c,1),this},g.prototype.emit=function(a){var b,c,d=Array.prototype.slice.call(arguments),e=d.slice(1),f=this._listeners[a];if(Array.isArray(f))for(b=0,c=f.length;b<c;b++)f[b].apply(this,e);for(f=this._listeners["*"],b=0,c=f.length;b<c;b++)f[b].apply(this,d);return this},h.prototype={add:function(a){this.o.add(a)},remove:function(a){return this.o["delete"](a)},union:function(a){var b=!0,c=!1,d=void 0;try{for(var e,f=a.o[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value;this.o.add(g)}}catch(h){c=!0,d=h}finally{try{!b&&f["return"]&&f["return"]()}finally{if(c)throw d}}return this},difference:function(a){var b=!0,c=!1,d=void 0;try{for(var e,f=a.o[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value;this.o["delete"](g)}}catch(h){c=!0,d=h}finally{try{!b&&f["return"]&&f["return"]()}finally{if(c)throw d}}return this},contains:function(a){return this.o.has(a)},iter:function(){return Array.from(this.o)},isEmpty:function(){return!this.o.size},size:function(){return this.o.size},equals:function(a){if(this.o.size!==a.size())return!1;var b=!0,c=!1,d=void 0;try{for(var e,f=this.o[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value;if(!a.contains(g))return!1}}catch(h){c=!0,d=h}finally{try{!b&&f["return"]&&f["return"]()}finally{if(c)throw d}}return!0},toString:function(){return"Set("+Array.from(this.o).toString()+")"}};var v=function(){function a(a){return new RegExp("^"+a.replace(/\./g,"\\.")+"(\\.[0-9a-zA-Z]+)*$")}function b(b){return d[b]?d[b]:d[b]=a(b)}function c(a,c){return c&&c.name&&(a.events.indexOf("*")>-1||a.events.filter(function(a){return b(a).test(c.name)}).length)}var d={};return function(a,b,d){return a.transitions.filter(function(a){return(!a.events||c(a,b))&&(!a.cond||d(a.cond))})}}(),w={getAncestors:function(a,b){var c;return c=a.ancestors.indexOf(b),c>-1?a.ancestors.slice(0,c):a.ancestors},getAncestorsOrSelf:function(a,b){return[a].concat(this.getAncestors(a,b))},getDescendantsOrSelf:function(a){return[a].concat(a.descendants)},isOrthogonalTo:function(a,b){return!this.isAncestrallyRelatedTo(a,b)&&this.getLCA(a,b).typeEnum===t.PARALLEL},isAncestrallyRelatedTo:function(a,b){return this.getAncestorsOrSelf(b).indexOf(a)>-1||this.getAncestorsOrSelf(a).indexOf(b)>-1},getLCA:function(a,b){var c=this.getAncestors(a).filter(function(a){return a.descendants.indexOf(b)>-1},this);return c[0]}};m.prototype=s(o(g.prototype),{start:function(){return this._configuration.add(this._model.initialRef),this._performBigStep(),this.getConfiguration()},startAsync:function(a){"function"!=typeof a&&(a=p),this._configuration.add(this._model.initialRef),this._performBigStepAsync(null,a)},getConfiguration:function(){return this._configuration.iter().map(function(a){return a.id})},getFullConfiguration:function(){return this._configuration.iter().map(function(a){return[a].concat(w.getAncestors(a))},this).reduce(function(a,b){return a.concat(b)},[]).map(function(a){return a.id}).reduce(function(a,b){return a.indexOf(b)>-1?a:a.concat(b)},[])},isIn:function(a){return this.getFullConfiguration().indexOf(a)>-1},isFinal:function(a){return this._isInFinalState},_performBigStep:function(a){this.emit("onBigStepBegin"),a&&this._internalEventQueue.push(a);for(var b=!0;b;){var c=this._internalEventQueue.shift()||null;this.emit("onSmallStepBegin",c);var d=this._performSmallStep(c);b=!d.isEmpty()}this._isInFinalState=this._configuration.iter().every(function(a){return a.typeEnum===t.FINAL}),this.emit("onBigStepEnd")},_performBigStepAsync:function(a,b){function c(a){var e;try{d.emit(a);var f=d._internalEventQueue.shift()||null;d.emit("onSmallStepBegin",f),e=d._performSmallStep(f),d.emit("onSmallStepEnd",f)}catch(g){return void b(g)}e.isEmpty()?(d._isInFinalState=d._configuration.iter().every(function(a){return a.typeEnum===t.FINAL}),d.emit("onBigStepEnd"),b(void 0,d.getConfiguration())):(d.emit("onBigStepSuspend"),setImmediate(c,"onBigStepResume"))}a&&this._internalEventQueue.push(a);var d=this;c("onBigStepBegin")},_performSmallStep:function(a){var c=this._selectTransitions(a);if(!c.isEmpty()){for(var d=new this.opts.Set(c.iter().filter(b)),f=this._getStatesExited(d),g=f[0],h=f[1],i=this._getStatesEntered(d),j=i[0],k=i[1],l=new this.opts.Set,m=0,n=h.length;m<n;m++){var o=h[m];if(this.opts.logStatesEnteredAndExited&&this.opts.console.log("exiting ",o.id),this.emit("onExit",o.id),void 0!==o.onExit)for(var p=0,q=o.onExit.length;p<q;p++)this._evaluateAction(a,o.onExit[p]);var r;o.historyRef&&(r=o.historyRef.isDeep?function(a){return a.typeEnum===t.BASIC&&o.descendants.indexOf(a)>-1}:function(a){return a.parent===o},this._historyValue[o.historyRef.id]=h.filter(r))}for(var s=c.iter().sort(e),u=0,n=s.length;u<n;u++){var v=s[u],w=v.targets&&v.targets.map(function(a){return a.id});if(this.emit("onTransition",v.source.id,w),void 0!==v.onTransition)for(var x=0,y=v.onTransition.length;x<y;x++)this._evaluateAction(a,v.onTransition[x])}for(var z=0,A=k.length;z<A;z++){var B=k[z];if(this.opts.logStatesEnteredAndExited&&this.opts.console.log("entering",B.id),this.emit("onEntry",B.id),void 0!==B.onEntry)for(var C=0,D=B.onEntry.length;C<D;C++)this._evaluateAction(a,B.onEntry[C])}this._configuration.difference(g),this._configuration.union(j),l.isEmpty()||this._internalEventQueue.push(l)}return c},_evaluateAction:function(a,b){try{return b.call(this._scriptingContext,a)}catch(c){var d={tagname:b.tagname,line:b.line,column:b.column,reason:c.message};this._internalEventQueue.push({name:"error.execution",data:d}),this.emit("onError",d)}},_getStatesExited:function(a){for(var b=new this.opts.Set,d=new this.opts.Set,e=a.iter(),f=0,g=e.length;f<g;f++)for(var h=e[f],i=h.scope,j=i.descendants,k=this._configuration.iter(),l=0,m=k.length;l<m;l++){var n=k[l];if(j.indexOf(n)>-1){d.add(n),b.add(n);for(var o=w.getAncestors(n,i),p=0,q=o.length;p<q;p++)b.add(o[p])}}var r=b.iter().sort(c);return[d,r]},_getStatesEntered:function(a){for(var b={statesToEnter:new this.opts.Set,basicStatesToEnter:new this.opts.Set,statesProcessed:new this.opts.Set,statesToProcess:[]},c=a.iter(),e=0,f=c.length;e<f;e++)for(var g=c[e],h=0,i=g.targets.length;h<i;h++)this._addStateAndAncestors(g.targets[h],g.scope,b);for(var j;j=b.statesToProcess.pop();)this._addStateAndDescendants(j,b);var k=b.statesToEnter.iter().sort(d);return[b.basicStatesToEnter,k]},_addStateAndAncestors:function(a,b,c){this._addStateAndDescendants(a,c);for(var d=w.getAncestors(a,b),e=0,f=d.length;e<f;e++){var g=d[e];g.typeEnum===t.COMPOSITE?(c.statesToEnter.add(g),c.statesProcessed.add(g)):this._addStateAndDescendants(g,c)}},_addStateAndDescendants:function(a,b){b.statesProcessed.contains(a)||(a.typeEnum===t.HISTORY?a.id in this._historyValue?this._historyValue[a.id].forEach(function(c){this._addStateAndAncestors(c,a.parent,b)},this):(b.statesToEnter.add(a),b.basicStatesToEnter.add(a)):(b.statesToEnter.add(a),a.typeEnum===t.PARALLEL?b.statesToProcess.push.apply(b.statesToProcess,a.states.filter(function(a){return a.typeEnum!==t.HISTORY})):a.typeEnum===t.COMPOSITE?b.statesToProcess.push(a.initialRef):a.typeEnum!==t.INITIAL&&a.typeEnum!==t.BASIC&&a.typeEnum!==t.FINAL||b.basicStatesToEnter.add(a)),b.statesProcessed.add(a))},_selectTransitions:function(a){if(this.opts.onlySelectFromBasicStates)var b=this._configuration.iter();else{for(var c=new this.opts.Set,d=this._configuration.iter(),e=0,f=d.length;e<f;e++){var g=d[e];c.add(g);for(var h=w.getAncestors(g),i=0,j=h.length;i<j;i++)c.add(h[i])}b=c.iter()}for(var k=a&&a.name&&a.name.search("."),l=k?v:this.opts.transitionSelector,m=new this.opts.Set,n=this._evaluateAction.bind(this,a),o=0,p=b.length;o<p;o++)for(var q=l(b[o],a,n),r=0,f=q.length;r<f;r++)m.add(q[r]);var s=this._selectPriorityEnabledTransitions(m);return s},_selectPriorityEnabledTransitions:function(a){var b=new this.opts.Set,c=this._getInconsistentTransitions(a),d=c[0],e=c[1];for(b.union(d);!e.isEmpty();)a=new this.opts.Set(e.iter().map(function(a){return this.opts.priorityComparisonFn(a)},this)),c=this._getInconsistentTransitions(a),d=c[0],e=c[1],b.union(d);return b},_getInconsistentTransitions:function(a){for(var b=new this.opts.Set,c=new this.opts.Set,d=a.iter(),e=0;e<d.length;e++)for(var f=e+1;f<d.length;f++){var g=d[e],h=d[f];this._conflicts(g,h)&&(b.add(g),b.add(h),c.add([g,h]))}var i=a.difference(b);return[i,c]},_conflicts:function(a,b){return!this._isArenaOrthogonal(a,b)},_isArenaOrthogonal:function(a,b){var c=w.isOrthogonalTo(a.scope,b.scope);return c},registerListener:function(a){a.onEntry&&this.on("onEntry",a.onEntry),a.onExit&&this.on("onExit",a.onExit),a.onTransition&&this.on("onTransition",a.onTransition),a.onError&&this.on("onError",a.onError),a.onBigStepBegin&&this.on("onBigStepBegin",a.onBigStepBegin),a.onBigStepSuspend&&this.on("onBigStepSuspend",a.onBigStepSuspend),a.onBigStepResume&&this.on("onBigStepResume",a.onBigStepResume),a.onSmallStepBegin&&this.on("onSmallStepBegin",a.onSmallStepBegin),a.onSmallStepEnd&&this.on("onSmallStepEnd",a.onSmallStepEnd),a.onBigStepEnd&&this.on("onBigStepEnd",a.onBigStepEnd)},unregisterListener:function(a){a.onEntry&&this.off("onEntry",a.onEntry),a.onExit&&this.off("onExit",a.onExit),a.onTransition&&this.off("onTransition",a.onTransition),a.onError&&this.off("onError",a.onError),a.onBigStepBegin&&this.off("onBigStepBegin",a.onBigStepBegin),a.onBigStepSuspend&&this.off("onBigStepSuspend",a.onBigStepSuspend),a.onBigStepResume&&this.off("onBigStepResume",a.onBigStepResume),a.onSmallStepBegin&&this.off("onSmallStepBegin",a.onSmallStepBegin),a.onSmallStepEnd&&this.off("onSmallStepEnd",a.onSmallStepEnd),a.onBigStepEnd&&this.off("onBigStepEnd",a.onBigStepEnd)},getAllTransitionEvents:function(){function a(c){if(c.transitions)for(var d=0,e=c.transitions.length;d<e;d++)b[c.transitions[d].event]=!0;if(c.states)for(var f=0,g=c.states.length;f<g;f++)a(c.states[f])}var b={};return a(this._model),Object.keys(b)},getSnapshot:function(){if(this._isStepping)throw new Error("getSnapshot cannot be called while interpreter is executing a big-step");return[this.getConfiguration(),this._serializeHistory(),this._isInFinalState,this._model.$serializeDatamodel()]},_serializeHistory:function(){var a={};return Object.keys(this._historyValue).forEach(function(b){a[b]=this._historyValue[b].map(function(a){return a.id})},this),a}}),n.prototype=o(m.prototype),n.prototype.gen=function(a,b){var c;switch("undefined"==typeof a?"undefined":r(a)){case"string":c={name:a,data:b};break;case"object":if("string"!=typeof a.name)throw new Error('Event object must have "name" property of type string.');c=a;break;default:throw new Error("First argument to gen must be a string or object.")}if(this._isStepping)throw new Error("Cannot call gen during a big-step");return this._isStepping=!0,this._performBigStep(c),this._isStepping=!1,this.getConfiguration()},n.prototype.genAsync=function(a,b){if("object"!==("undefined"==typeof a?"undefined":r(a))||!a||"string"!=typeof a.name)throw new Error("expected currentEvent to be an Object with a name");if(this._isStepping)throw new Error("Cannot call gen during a big-step");"function"!=typeof b&&(b=p),this._isStepping=!0;var c=this;this._performBigStepAsync(a,function(a,d){c._isStepping=!1,b(a,d)})};var x=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/i;q.prototype={raise:function(a){this._interpreter._internalEventQueue.push(a)},send:function(a,b){function c(a,b,c){if(a.target){var d=x.test(a.target);if(!d)return this.raise({name:"error.execution",data:"Target is not valid URI",sendid:b.sendid})}var e=Object.keys(u).map(function(a){return u[a].location});return e.indexOf(a.type)===-1?this.raise({name:"error.execution",data:"Unsupported event processor type",sendid:b.sendid}):void c.call(this,a,b)}function d(a,b){if("undefined"==typeof setTimeout)throw new Error("Default implementation of Statechart.prototype.send will not work unless setTimeout is defined globally.");var c=setTimeout(this._interpreter.gen.bind(this._interpreter,a),b.delay||0);b.sendid&&(this._timeoutMap[b.sendid]=c)}function e(){this._interpreter.emit(a.name,a.data)}a.type=a.type||u.scxml.location;var f;f="https://github.com/jbeard4/SCION#publish"===a.type?e:this._interpreter.opts.customSend?this._interpreter.opts.customSend:d,b=b||{},c.call(this,a,b,f)},cancel:function(a){if(this._interpreter.opts.customCancel)return this._interpreter.opts.customCancel.apply(this,[a]);if("undefined"==typeof clearTimeout)throw new Error("Default implementation of Statechart.prototype.cancel will not work unless setTimeout is defined globally.");a in this._timeoutMap&&clearTimeout(this._timeoutMap[a])}},a.exports={BaseInterpreter:m,Statechart:n,ArraySet:h,STATE_TYPES:t,initializeModel:f,InterpreterScriptingContext:q,ioProcessorTypes:u}}); | ||
/*! scion-core 2017-03-31 */ | ||
!function(a,b){if("function"==typeof define&&define.amd)define(["module"],b);else if("undefined"!=typeof exports)b(module);else{var c={exports:{}};b(c),a.scion=c.exports}}(this,function(a){"use strict";function b(a){return a.targets}function c(a,b){return b.depth-a.depth}function d(a,b){return a.depth-b.depth}function e(a,b){return a.documentOrder-b.documentOrder}function f(a){function b(a){void 0===m[a]&&(m[a]=0);var b=m[a]++;return"$generated-"+a+"-"+b}function c(a){return{$deserializeDatamodel:a.$deserializeDatamodel||function(){},$serializeDatamodel:a.$serializeDatamodel||function(){return null},$idToStateMap:k,states:[{$type:"initial",transitions:[{target:a}]},a]}}function d(a,c){if(c.transitions&&j.push.apply(j,c.transitions),c.id){if(k.has(c.id))throw new Error("Redefinition of state id "+c.id);k.set(c.id,c)}c.$type=c.$type||"state",c.ancestors=a,c.depth=a.length,c.parent=a[0],c.transitions=c.transitions||[];for(var f=0,g=c.transitions.length;f<g;f++){var h=c.transitions[f];h.documentOrder=l++,h.source=c}if(c.states)for(var i=[c].concat(a),f=0,g=c.states.length;f<g;f++)d(i,c.states[f]);switch(c.$type){case"parallel":c.typeEnum=w.PARALLEL;break;case"initial":c.typeEnum=w.INITIAL;break;case"history":c.typeEnum=w.HISTORY;break;case"final":c.typeEnum=w.FINAL;break;case"state":case"scxml":c.states&&c.states.length?c.typeEnum=w.COMPOSITE:c.typeEnum=w.BASIC;break;default:throw new Error("Unknown state type: "+c.$type)}c.states?c.descendants=c.states.concat(c.states.map(function(a){return a.descendants}).reduce(function(a,b){return a.concat(b)},[])):c.descendants=[];var m;if(c.typeEnum===w.COMPOSITE&&("string"==typeof c.initial?n.push(c):(m=c.states.filter(function(a){return"initial"===a.$type}),c.initialRef=m.length?m[0]:c.states[0],e(c))),c.typeEnum===w.COMPOSITE||c.typeEnum===w.PARALLEL){var o=c.states.filter(function(a){return"history"===a.$type});c.historyRef=o[0]}c.id||(c.id=b(c.$type),k.set(c.id,c)),c.onEntry&&!Array.isArray(c.onEntry)&&(c.onEntry=[c.onEntry]),c.onExit&&!Array.isArray(c.onExit)&&(c.onExit=[c.onExit])}function e(a){if(!a.initialRef)throw new Error("Unable to locate initial state for composite state: "+a.id)}function f(){for(var a=0,b=n.length;a<b;a++){var c=n[a];c.initialRef=k.get(c.initial),e(c)}}function g(){for(var a=0,b=j.length;a<b;a++){var c=j[a];if(c.onTransition&&!Array.isArray(c.onTransition)&&(c.onTransition=[c.onTransition]),"string"==typeof c.event&&(c.events=c.event.trim().split(o)),delete c.event,!c.targets&&"undefined"!=typeof c.target)if("string"==typeof c.target){var d=k.get(c.target);if(!d)throw new Error("Unable to find target state with id "+c.target);c.target=d,c.targets=[c.target]}else if(Array.isArray(c.target))c.targets=c.target.map(function(a){if("string"==typeof a){if(a=k.get(a),!a)throw new Error("Unable to find target state with id "+c.target);return a}return a});else{if("object"!==u(c.target))throw new Error("Transition target has unknown type: "+c.target);c.targets=[c.target]}}for(var a=0,b=j.length;a<b;a++){var c=j[a];c.targets&&(c.lcca=i(c.source,c.targets[0])),c.scope=h(c)}}function h(a){var b="internal"===a.type&&a.source.parent&&a.targets&&a.targets.every(function(b){return a.source.descendants.indexOf(b)>-1});return a.targets?b?a.source:a.lcca:a.source}function i(a,b){for(var c=[],d=0,e=a.ancestors.length;d<e;d++){var f=a.ancestors[d];f.typeEnum===w.COMPOSITE&&f.descendants.indexOf(b)>-1&&c.push(f)}if(!c.length)throw new Error("Could not find LCA for states.");return c[0]}var j=[],k=new Map,l=0,m={},n=[],o=/\s+/,p=c(a);return d([],p),g(),f(),p}function g(){this._listeners={},this._listeners["*"]=[]}function h(a){a=a||[],this.o=new Set(a)}function i(a,b){return a=a.replace(y,""),a===b||!(a.length>b.length)&&("."===b.charAt(a.length)&&0===b.indexOf(a))}function j(a,b){return a.events.some(function(a){return"*"===a||i(a,b)})}function k(a,b,c){return a.transitions.filter(function(a){return(!a.events||b&&b.name&&j(a,b.name))&&(!a.cond||c(a.cond))})}function l(a){var b=a[0],c=a[1];return b.source.depth<c.source.depth?c:c.source.depth<b.source.depth?b:b.documentOrder<c.documentOrder?b:c}function m(a,b,c){return b.x=b.x||{},a.call(c,b.x,b.sessionid,b.ioprocessors,c.isIn.bind(c))}function n(a,b){return a.map(function(a){var c=b.get(a);if(!c)throw new Error("Error loading serialized configuration. Unable to locate state with id "+a);return c})}function o(a,b){var c={};return Object.keys(a).forEach(function(d){c[d]=a[d].map(function(a){var c=b.get(a);if(!c)throw new Error("Error loading serialized history. Unable to locate state with id "+a);return c})}),c}function p(a,b){g.call(this),this._scriptingContext=b.interpreterScriptingContext||(b.InterpreterScriptingContext?new b.InterpreterScriptingContext(this):{});var c;c="function"==typeof a?m(a,b,this):"string"==typeof a?JSON.parse(a):a,this._model=f(c),this.opts=b||{},this.opts.console=b.console||("undefined"==typeof console?{log:function(){}}:console),this.opts.Set=this.opts.Set||h,this.opts.priorityComparisonFn=this.opts.priorityComparisonFn||l,this.opts.transitionSelector=this.opts.transitionSelector||k,this._scriptingContext.log=this._scriptingContext.log||function(){this.opts.console.log.apply?this.opts.console.log.apply(this.opts.console,arguments):this.opts.console.log(Array.prototype.slice.apply(arguments).join(","))}.bind(this),this._internalEventQueue=[],b.snapshot?(this._configuration=new this.opts.Set(n(b.snapshot[0],this._model.$idToStateMap)),this._historyValue=o(b.snapshot[1],this._model.$idToStateMap),this._isInFinalState=b.snapshot[2],this._model.$deserializeDatamodel(b.snapshot[3])):(this._configuration=new this.opts.Set,this._historyValue={},this._isInFinalState=!1),this._x={_sessionId:b.sessionId||null,_name:c.name||b.name||null,_ioprocessors:b.ioprocessors||null}}function q(a,b){b=b||{},b.ioprocessors={};for(var c in x)b.ioprocessors[c]=x[c];b.InterpreterScriptingContext=b.InterpreterScriptingContext||t,this._isStepping=!1,p.call(this,a,b)}function r(a){function b(){}return b.prototype=a,new b}function s(){}function t(a){this._interpreter=a,this._timeoutMap={}}var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol?"symbol":typeof a},v=Object.assign||function(a,b){return Object.keys(b).forEach(function(c){a[c]=b[c]}),a},w={BASIC:0,COMPOSITE:1,PARALLEL:2,HISTORY:3,INITIAL:4,FINAL:5},x={scxml:{location:"http://www.w3.org/TR/scxml/#SCXMLEventProcessor"},basichttp:{location:"http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"},dom:{location:"http://www.w3.org/TR/scxml/#DOMEventProcessor"},publish:{location:"https://github.com/jbeard4/SCION#publish"}};g.prototype.on=function(a,b){return Array.isArray(this._listeners[a])||(this._listeners[a]=[]),this._listeners[a].indexOf(b)===-1&&this._listeners[a].push(b),this},g.prototype.once=function(a,b){function c(){for(var e=[],f=0;f<arguments.length;f+=1)e[f]=arguments[f];d.off(a,c),b.apply(d,e)}var d=this;return c.listener=b,this.on(a,c)},g.prototype.off=function(a,b){if(!Array.isArray(this._listeners[a]))return this;if("undefined"==typeof b)return this._listeners[a]=[],this;var c=this._listeners[a].indexOf(b);if(c===-1)for(var d=0;d<this._listeners[a].length;d+=1)if(this._listeners[a][d].listener===b){c=d;break}return this._listeners[a].splice(c,1),this},g.prototype.emit=function(a){var b,c,d=Array.prototype.slice.call(arguments),e=d.slice(1),f=this._listeners[a];if(Array.isArray(f))for(b=0,c=f.length;b<c;b++)f[b].apply(this,e);for(f=this._listeners["*"],b=0,c=f.length;b<c;b++)f[b].apply(this,d);return this},h.prototype={add:function(a){this.o.add(a)},remove:function(a){return this.o["delete"](a)},union:function(a){var b=!0,c=!1,d=void 0;try{for(var e,f=a.o[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value;this.o.add(g)}}catch(h){c=!0,d=h}finally{try{!b&&f["return"]&&f["return"]()}finally{if(c)throw d}}return this},difference:function(a){var b=!0,c=!1,d=void 0;try{for(var e,f=a.o[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value;this.o["delete"](g)}}catch(h){c=!0,d=h}finally{try{!b&&f["return"]&&f["return"]()}finally{if(c)throw d}}return this},contains:function(a){return this.o.has(a)},iter:function(){return Array.from(this.o)},isEmpty:function(){return!this.o.size},size:function(){return this.o.size},equals:function(a){if(this.o.size!==a.size())return!1;var b=!0,c=!1,d=void 0;try{for(var e,f=this.o[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value;if(!a.contains(g))return!1}}catch(h){c=!0,d=h}finally{try{!b&&f["return"]&&f["return"]()}finally{if(c)throw d}}return!0},toString:function(){return"Set("+Array.from(this.o).toString()+")"}};var y=/\.\*$/,z={getAncestors:function(a,b){var c;return c=a.ancestors.indexOf(b),c>-1?a.ancestors.slice(0,c):a.ancestors},getAncestorsOrSelf:function(a,b){return[a].concat(this.getAncestors(a,b))},getDescendantsOrSelf:function(a){return[a].concat(a.descendants)},isOrthogonalTo:function(a,b){return!this.isAncestrallyRelatedTo(a,b)&&this.getLCA(a,b).typeEnum===w.PARALLEL},isAncestrallyRelatedTo:function(a,b){return this.getAncestorsOrSelf(b).indexOf(a)>-1||this.getAncestorsOrSelf(a).indexOf(b)>-1},getLCA:function(a,b){var c=this.getAncestors(a).filter(function(a){return a.descendants.indexOf(b)>-1},this);return c[0]}};p.prototype=v(r(g.prototype),{start:function(){return this._configuration.add(this._model.initialRef),this._performBigStep(),this.getConfiguration()},startAsync:function(a){"function"!=typeof a&&(a=s),this._configuration.add(this._model.initialRef),this._performBigStepAsync(null,a)},getConfiguration:function(){return this._configuration.iter().map(function(a){return a.id})},getFullConfiguration:function(){return this._configuration.iter().map(function(a){return[a].concat(z.getAncestors(a))},this).reduce(function(a,b){return a.concat(b)},[]).map(function(a){return a.id}).reduce(function(a,b){return a.indexOf(b)>-1?a:a.concat(b)},[])},isIn:function(a){return this.getFullConfiguration().indexOf(a)>-1},isFinal:function(a){return this._isInFinalState},_performBigStep:function(a){this.emit("onBigStepBegin"),a&&this._internalEventQueue.push(a);for(var b=!0;b;){var c=this._internalEventQueue.shift()||null;this.emit("onSmallStepBegin",c);var d=this._performSmallStep(c);b=!d.isEmpty()}this._isInFinalState=this._configuration.iter().every(function(a){return a.typeEnum===w.FINAL}),this.emit("onBigStepEnd")},_performBigStepAsync:function(a,b){function c(a){var e;try{d.emit(a);var f=d._internalEventQueue.shift()||null;d.emit("onSmallStepBegin",f),e=d._performSmallStep(f),d.emit("onSmallStepEnd",f)}catch(g){return void b(g)}e.isEmpty()?(d._isInFinalState=d._configuration.iter().every(function(a){return a.typeEnum===w.FINAL}),d.emit("onBigStepEnd"),b(void 0,d.getConfiguration())):(d.emit("onBigStepSuspend"),setImmediate(c,"onBigStepResume"))}a&&this._internalEventQueue.push(a);var d=this;c("onBigStepBegin")},_performSmallStep:function(a){var c=this._selectTransitions(a);if(!c.isEmpty()){for(var d=new this.opts.Set(c.iter().filter(b)),f=this._getStatesExited(d),g=f[0],h=f[1],i=this._getStatesEntered(d),j=i[0],k=i[1],l=new this.opts.Set,m=0,n=h.length;m<n;m++){var o=h[m];if(this.opts.logStatesEnteredAndExited&&this.opts.console.log("exiting ",o.id),this.emit("onExit",o.id),void 0!==o.onExit)for(var p=0,q=o.onExit.length;p<q;p++)this._evaluateAction(a,o.onExit[p]);var r;o.historyRef&&(r=o.historyRef.isDeep?function(a){return a.typeEnum===w.BASIC&&o.descendants.indexOf(a)>-1}:function(a){return a.parent===o},this._historyValue[o.historyRef.id]=h.filter(r))}for(var s=c.iter().sort(e),t=0,n=s.length;t<n;t++){var u=s[t],v=u.targets&&u.targets.map(function(a){return a.id});if(this.emit("onTransition",u.source.id,v,t),void 0!==u.onTransition)for(var x=0,y=u.onTransition.length;x<y;x++)this._evaluateAction(a,u.onTransition[x])}for(var z=0,A=k.length;z<A;z++){var B=k[z];if(this.opts.logStatesEnteredAndExited&&this.opts.console.log("entering",B.id),this.emit("onEntry",B.id),void 0!==B.onEntry)for(var C=0,D=B.onEntry.length;C<D;C++)this._evaluateAction(a,B.onEntry[C])}this._configuration.difference(g),this._configuration.union(j),l.isEmpty()||this._internalEventQueue.push(l)}return c},_evaluateAction:function(a,b){try{return b.call(this._scriptingContext,a)}catch(c){var d={tagname:b.tagname,line:b.line,column:b.column,reason:c.message};this._internalEventQueue.push({name:"error.execution",data:d}),this.emit("onError",d)}},_getStatesExited:function(a){for(var b=new this.opts.Set,d=new this.opts.Set,e=a.iter(),f=0,g=e.length;f<g;f++)for(var h=e[f],i=h.scope,j=i.descendants,k=this._configuration.iter(),l=0,m=k.length;l<m;l++){var n=k[l];if(j.indexOf(n)>-1){d.add(n),b.add(n);for(var o=z.getAncestors(n,i),p=0,q=o.length;p<q;p++)b.add(o[p])}}var r=b.iter().sort(c);return[d,r]},_getStatesEntered:function(a){for(var b={statesToEnter:new this.opts.Set,basicStatesToEnter:new this.opts.Set,statesProcessed:new this.opts.Set,statesToProcess:[]},c=a.iter(),e=0,f=c.length;e<f;e++)for(var g=c[e],h=0,i=g.targets.length;h<i;h++)this._addStateAndAncestors(g.targets[h],g.scope,b);for(var j;j=b.statesToProcess.pop();)this._addStateAndDescendants(j,b);var k=b.statesToEnter.iter().sort(d);return[b.basicStatesToEnter,k]},_addStateAndAncestors:function(a,b,c){this._addStateAndDescendants(a,c);for(var d=z.getAncestors(a,b),e=0,f=d.length;e<f;e++){var g=d[e];g.typeEnum===w.COMPOSITE?(c.statesToEnter.add(g),c.statesProcessed.add(g)):this._addStateAndDescendants(g,c)}},_addStateAndDescendants:function(a,b){b.statesProcessed.contains(a)||(a.typeEnum===w.HISTORY?a.id in this._historyValue?this._historyValue[a.id].forEach(function(c){this._addStateAndAncestors(c,a.parent,b)},this):(b.statesToEnter.add(a),b.basicStatesToEnter.add(a)):(b.statesToEnter.add(a),a.typeEnum===w.PARALLEL?b.statesToProcess.push.apply(b.statesToProcess,a.states.filter(function(a){return a.typeEnum!==w.HISTORY})):a.typeEnum===w.COMPOSITE?b.statesToProcess.push(a.initialRef):a.typeEnum!==w.INITIAL&&a.typeEnum!==w.BASIC&&a.typeEnum!==w.FINAL||b.basicStatesToEnter.add(a)),b.statesProcessed.add(a))},_selectTransitions:function(a){if(this.opts.onlySelectFromBasicStates)var b=this._configuration.iter();else{for(var c=new this.opts.Set,d=this._configuration.iter(),e=0,f=d.length;e<f;e++){var g=d[e];c.add(g);for(var h=z.getAncestors(g),i=0,j=h.length;i<j;i++)c.add(h[i])}b=c.iter()}for(var k=this.opts.transitionSelector,l=new this.opts.Set,m=this._evaluateAction.bind(this,a),n=0,o=b.length;n<o;n++)for(var p=k(b[n],a,m),q=0,f=p.length;q<f;q++)l.add(p[q]);var r=this._selectPriorityEnabledTransitions(l);return r},_selectPriorityEnabledTransitions:function(a){var b=new this.opts.Set,c=this._getInconsistentTransitions(a),d=c[0],e=c[1];for(b.union(d);!e.isEmpty();)a=new this.opts.Set(e.iter().map(function(a){return this.opts.priorityComparisonFn(a)},this)),c=this._getInconsistentTransitions(a),d=c[0],e=c[1],b.union(d);return b},_getInconsistentTransitions:function(a){for(var b=new this.opts.Set,c=new this.opts.Set,d=a.iter(),e=0;e<d.length;e++)for(var f=e+1;f<d.length;f++){var g=d[e],h=d[f];this._conflicts(g,h)&&(b.add(g),b.add(h),c.add([g,h]))}var i=a.difference(b);return[i,c]},_conflicts:function(a,b){return!this._isArenaOrthogonal(a,b)},_isArenaOrthogonal:function(a,b){var c=z.isOrthogonalTo(a.scope,b.scope);return c},registerListener:function(a){a.onEntry&&this.on("onEntry",a.onEntry),a.onExit&&this.on("onExit",a.onExit),a.onTransition&&this.on("onTransition",a.onTransition),a.onError&&this.on("onError",a.onError),a.onBigStepBegin&&this.on("onBigStepBegin",a.onBigStepBegin),a.onBigStepSuspend&&this.on("onBigStepSuspend",a.onBigStepSuspend),a.onBigStepResume&&this.on("onBigStepResume",a.onBigStepResume),a.onSmallStepBegin&&this.on("onSmallStepBegin",a.onSmallStepBegin),a.onSmallStepEnd&&this.on("onSmallStepEnd",a.onSmallStepEnd),a.onBigStepEnd&&this.on("onBigStepEnd",a.onBigStepEnd)},unregisterListener:function(a){a.onEntry&&this.off("onEntry",a.onEntry),a.onExit&&this.off("onExit",a.onExit),a.onTransition&&this.off("onTransition",a.onTransition),a.onError&&this.off("onError",a.onError),a.onBigStepBegin&&this.off("onBigStepBegin",a.onBigStepBegin),a.onBigStepSuspend&&this.off("onBigStepSuspend",a.onBigStepSuspend),a.onBigStepResume&&this.off("onBigStepResume",a.onBigStepResume),a.onSmallStepBegin&&this.off("onSmallStepBegin",a.onSmallStepBegin),a.onSmallStepEnd&&this.off("onSmallStepEnd",a.onSmallStepEnd),a.onBigStepEnd&&this.off("onBigStepEnd",a.onBigStepEnd)},getAllTransitionEvents:function(){function a(c){if(c.transitions)for(var d=0,e=c.transitions.length;d<e;d++)b[c.transitions[d].event]=!0;if(c.states)for(var f=0,g=c.states.length;f<g;f++)a(c.states[f])}var b={};return a(this._model),Object.keys(b)},getSnapshot:function(){if(this._isStepping)throw new Error("getSnapshot cannot be called while interpreter is executing a big-step");return[this.getConfiguration(),this._serializeHistory(),this._isInFinalState,this._model.$serializeDatamodel()]},_serializeHistory:function(){var a={};return Object.keys(this._historyValue).forEach(function(b){a[b]=this._historyValue[b].map(function(a){return a.id})},this),a}}),q.prototype=r(p.prototype),q.prototype.gen=function(a,b){var c;switch("undefined"==typeof a?"undefined":u(a)){case"string":c={name:a,data:b};break;case"object":if("string"!=typeof a.name)throw new Error('Event object must have "name" property of type string.');c=a;break;default:throw new Error("First argument to gen must be a string or object.")}if(this._isStepping)throw new Error("Cannot call gen during a big-step");return this._isStepping=!0,this._performBigStep(c),this._isStepping=!1,this.getConfiguration()},q.prototype.genAsync=function(a,b){if("object"!==("undefined"==typeof a?"undefined":u(a))||!a||"string"!=typeof a.name)throw new Error("expected currentEvent to be an Object with a name");if(this._isStepping)throw new Error("Cannot call gen during a big-step");"function"!=typeof b&&(b=s),this._isStepping=!0;var c=this;this._performBigStepAsync(a,function(a,d){c._isStepping=!1,b(a,d)})};var A=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/i;t.prototype={raise:function(a){this._interpreter._internalEventQueue.push(a)},send:function(a,b){function c(a,b,c){if(a.target){var d=A.test(a.target);if(!d)return this.raise({name:"error.execution",data:"Target is not valid URI",sendid:b.sendid})}var e=Object.keys(x).map(function(a){return x[a].location});return e.indexOf(a.type)===-1?this.raise({name:"error.execution",data:"Unsupported event processor type",sendid:b.sendid}):void c.call(this,a,b)}function d(a,b){if("undefined"==typeof setTimeout)throw new Error("Default implementation of Statechart.prototype.send will not work unless setTimeout is defined globally.");var c=setTimeout(this._interpreter.gen.bind(this._interpreter,a),b.delay||0);b.sendid&&(this._timeoutMap[b.sendid]=c)}function e(){this._interpreter.emit(a.name,a.data)}a.type=a.type||x.scxml.location;var f;f="https://github.com/jbeard4/SCION#publish"===a.type?e:this._interpreter.opts.customSend?this._interpreter.opts.customSend:d,b=b||{},c.call(this,a,b,f)},cancel:function(a){if(this._interpreter.opts.customCancel)return this._interpreter.opts.customCancel.apply(this,[a]);if("undefined"==typeof clearTimeout)throw new Error("Default implementation of Statechart.prototype.cancel will not work unless setTimeout is defined globally.");a in this._timeoutMap&&clearTimeout(this._timeoutMap[a])}},a.exports={BaseInterpreter:p,Statechart:q,ArraySet:h,STATE_TYPES:w,initializeModel:f,InterpreterScriptingContext:t,ioProcessorTypes:x}}); |
@@ -14,3 +14,3 @@ var _ = require('underscore'); | ||
var defaultFF = [5, 10, 20, 30, 40, 46, 47 ], | ||
defaultChrome = [26, 36, 51, 'dev', 'beta']; | ||
defaultChrome = [26, 36, 51, 'beta']; | ||
@@ -17,0 +17,0 @@ addBrowser('internet explorer', 'Windows 10', 11); |
@@ -476,31 +476,35 @@ // Copyright 2011-2012 Jacob Beard, INFICON, and other SCION contributors | ||
var scxmlPrefixTransitionSelector = (function(){ | ||
const RX_TRAILING_WILDCARD = /\.\*$/; | ||
var eventNameReCache = {}; | ||
function isEventPrefixMatch(prefix, fullName) { | ||
prefix = prefix.replace(RX_TRAILING_WILDCARD, ''); | ||
function eventNameToRe(name) { | ||
return new RegExp("^" + (name.replace(/\./g, "\\.")) + "(\\.[0-9a-zA-Z]+)*$"); | ||
if (prefix === fullName) { | ||
return true; | ||
} | ||
function retrieveEventRe(name) { | ||
return eventNameReCache[name] ? eventNameReCache[name] : eventNameReCache[name] = eventNameToRe(name); | ||
if (prefix.length > fullName.length) { | ||
return false; | ||
} | ||
function nameMatch(t, event) { | ||
return event && event.name && | ||
(t.events.indexOf("*") > -1 ? | ||
true : | ||
t.events.filter(function(tEvent){ | ||
return retrieveEventRe(tEvent).test(event.name); | ||
}).length); | ||
if (fullName.charAt(prefix.length) !== '.') { | ||
return false; | ||
} | ||
return function(state, event, evaluator) { | ||
return state.transitions.filter(function(t){ | ||
return (!t.events || nameMatch(t,event)) && (!t.cond || evaluator(t.cond)); | ||
}); | ||
}; | ||
})(); | ||
return (fullName.indexOf(prefix) === 0); | ||
} | ||
function isTransitionMatch(t, eventName) { | ||
return t.events.some((tEvent) => { | ||
return tEvent === '*' || isEventPrefixMatch(tEvent, eventName); | ||
}); | ||
} | ||
function scxmlPrefixTransitionSelector(state, event, evaluator) { | ||
return state.transitions.filter((t) => { | ||
return (!t.events || (event && event.name && isTransitionMatch(t, event.name))) | ||
&& (!t.cond || evaluator(t.cond)); | ||
}); | ||
} | ||
//model accessor functions | ||
@@ -842,3 +846,3 @@ var query = { | ||
this.emit('onTransition',transition.source.id,targetIds); | ||
this.emit('onTransition',transition.source.id,targetIds, stxIdx); | ||
@@ -1050,7 +1054,3 @@ if(transition.onTransition !== undefined) { | ||
var usePrefixMatchingAlgorithm = currentEvent && currentEvent.name && currentEvent.name.search("."); | ||
var transitionSelector = usePrefixMatchingAlgorithm ? scxmlPrefixTransitionSelector : this.opts.transitionSelector; | ||
var transitionSelector = this.opts.transitionSelector; | ||
var enabledTransitions = new this.opts.Set(); | ||
@@ -1057,0 +1057,0 @@ |
{ | ||
"name": "scion-core", | ||
"version": "1.2.1", | ||
"version": "1.3.2", | ||
"description": "StateCharts Interpretation and Optimization eNgine (SCION) CORE is an implementation of Statecharts in JavaScript.", | ||
@@ -46,3 +46,3 @@ "keywords": [ | ||
"grunt-release": "^0.14.0", | ||
"grunt-saucelabs": "^8.6.3", | ||
"grunt-saucelabs": "9.0.0", | ||
"load-grunt-tasks": "^3.5.0", | ||
@@ -49,0 +49,0 @@ "minimist": "^1.2.0", |
470
README.md
@@ -1,17 +0,6 @@ | ||
[![Build status](https://travis-ci.org/jbeard4/SCION-CORE.svg?branch=master)](https://travis-ci.org/jbeard4/SCION-CORE) | ||
[![Sauce Test Status](https://saucelabs.com/buildstatus/jbeard4?branch=master)](https://saucelabs.com/u/jbeard4) | ||
[![Sauce Test Status](https://saucelabs.com/browser-matrix/jbeard4.svg?branch=master)](https://saucelabs.com/u/jbeard4) | ||
# Overview | ||
Statecharts is a powerful modelling language for developing **complex, timed, event-driven, state-based systems**. For an overview of Statecharts see [Statecharts: A Visual Formalism For Complex Systems](http://websrv0a.sdu.dk/ups/ESD/materials/harel-Statecharts.pdf) and [The Rhapsody Semantics of Statecharts](http://research.microsoft.com/pubs/148761/Charts04.pdf). | ||
SCION-CORE is a small implementation of Statecharts in ECMAScript (JavaScript). SCION-CORE lets you program with Statecharts using a simple JavaScript/JSON API. | ||
SCION-CORE is a small (2.9kb, minified and gzipped), embeddable implementation of Statecharts in ECMAScript (JavaScript). SCION-CORE lets you program with Statecharts using a simple JavaScript/JSON API. It can be used in the browser to manage complex user interface behaviour, or on the server under Node.js or Rhino to manage page navigation and asynchronous control flow. It can even be used in custom JavaScript environments, such as the Mozilla Spidermonkey shell. | ||
SCION-CORE is written so as to abstract out platform dependencies, and is implemented as a single UMD module, which makes it easy to deploy in any JavaScript environment. The philosophy of SCION-CORE is **"write once, embed everywhere"**. | ||
SCION-CORE powers [SCION](https://github.com/jbeard4/SCION), an implementation of [W3C SCXML](http://www.w3.org/TR/scxml) in JavaScript, and as such, it supports all of the features of the SCXML core module, including compound states ( **OR** states), parallel states ( **AND** states), and history states. | ||
# Installation | ||
@@ -50,207 +39,100 @@ | ||
# API | ||
## Rhino | ||
## new scion.Statechart(model) | ||
Get it with git: | ||
The SCXML constructor creates an interpreter instance from a model object. | ||
git clone git://github.com/jbeard4/SCION-CORE.git | ||
```javascript | ||
//same model can be used to create multiple interpreter instances | ||
var sc1 = new scion.Statechart(model), | ||
sc2 = new scion.Statechart(model); | ||
``` | ||
Rhino 1.7R3 supports CommonJS modules, so SCION-CORE can be used as follows: | ||
## sc.start() : `<String>`[] | ||
```bash | ||
`sc.start` starts the SCION-CORE interpreter. `sc.start` should only be called once, and should be called before `sc.gen` is called for the first time. | ||
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 `sc.start` completes. | ||
#just put SCION-CORE/lib on your modules path | ||
rhino -modules path/to/SCION-CORE/lib -main path/to/your/script.js | ||
``` | ||
## sc.gen(String eventName, Object eventData) : `<String>`[] | ||
## sc.gen({name : String, data : Object}) : `<String>`[] | ||
# Quickstart and Simple Use Case | ||
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. | ||
Let's start with the simple example of drag-and-drop behaviour in the browser. You can run this demo live on jsfiddle [here](http://jsfiddle.net/jbeard4/MDkLe/11/). | ||
`sc.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 `sc.gen` completes. | ||
An entity that can be dragged has two states: idle and dragging. If the entity is in an idle state, and it receives a mousedown event, then it starts dragging. While dragging, if it receives a mousemove event, then it changes its position. Also while dragging, when it receives a mouseup event, it returns to the idle state. | ||
```javascript | ||
var sc = new scion.Statechart(model), | ||
This natural-language description of behaviour can be described using the following simple state machine: | ||
var data = {foo:1}; | ||
var configuration = sc.gen("eventName",data); | ||
![Drag and Drop](http://jbeard4.github.com/SCION/img/drag_and_drop.png) | ||
//the following call is equivalent | ||
var configuration = sc.gen({name:"eventName",data:{foo:1}}); | ||
``` | ||
This state machine could be written in SCION-CORE's JSON syntax as follows: | ||
## Event Emitter | ||
```javascript | ||
{ | ||
"states" : [ | ||
{ | ||
"id" : "idle", | ||
"transitions" : [ | ||
{ | ||
"event" : "mousedown", | ||
"target" : "dragging", | ||
} | ||
] | ||
}, | ||
{ | ||
"id" : "dragging", | ||
"transitions" : [ | ||
{ | ||
"event" : "mouseup", | ||
"target" : "idle", | ||
}, | ||
{ | ||
"event" : "mousemove", | ||
"target" : "dragging" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
``` | ||
SCION-CORE includes the [tiny-events](https://github.com/ZauberNerd/tiny-events) library, and implements the following EventEmitter methods: | ||
One can add action code in order to script an HTML DOM element, so as to change its position on mousemove events: | ||
* on(type: string, listener: Function): EventEmitter | ||
* once(type: string, listener: Function): EventEmitter | ||
* off(type: string, listener?: Function): EventEmitter | ||
* emit(type: string, ...args: any[]): EventEmitter | ||
```javascript | ||
//declare the your statechart model, same as before | ||
var firstEvent, | ||
eventStamp, | ||
rectNode = document.getElementById('rect'), | ||
rectX = 0, | ||
rectY = 0; | ||
SCION-CORE emits the following events: | ||
var statechartModel = { | ||
states : [ | ||
{ | ||
id : 'idle', | ||
onEntry : function(){ | ||
rectNode.textContent='idle'; | ||
}, | ||
transitions : [ | ||
{ | ||
event : 'mousedown', | ||
target : 'dragging', | ||
onTransition : function(event){ | ||
eventStamp = firstEvent = event.data; | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
id : 'dragging', | ||
onEntry : function(){ | ||
rectNode.textContent='dragging'; | ||
}, | ||
transitions : [ | ||
{ | ||
event : 'mouseup', | ||
target : 'idle' | ||
}, | ||
{ | ||
event : 'mousemove', | ||
target : 'dragging', | ||
onTransition : function(event){ | ||
var dx = eventStamp.clientX - event.data.clientX; | ||
var dy = eventStamp.clientY - event.data.clientY; | ||
* onEntry | ||
* onExit | ||
* onTransition | ||
* onBigStepBegin | ||
* onBigStepSuspend | ||
* onBigStepResume | ||
* onSmallStepBegin | ||
* onSmallStepEnd | ||
* onBigStepEnd | ||
* onError | ||
rectNode.style.left = (rectX -= dx) + 'px'; | ||
rectNode.style.top = (rectY -= dy) + 'px'; | ||
eventStamp = event.data; | ||
} | ||
} | ||
] | ||
} | ||
] | ||
}; | ||
``` | ||
The `onError` callback receives an object containing the following properties: | ||
You can then perform the following steps to script web content: | ||
* `tagname` - The name of the element that produced the error. | ||
* `line` - The line in the source file in which the error occurred. | ||
* `column` - The column in the source file in which the error occurred. | ||
* `reason` - An informative error message. The text is platform-specific and subject to change. | ||
1. Use the statecharts model object to instantiate the SCXML interpreter. | ||
2. Connect relevant event listeners to the SCXML interpreter. | ||
3. Call the `start` method on the SCXML interpreter to start execution of the statechart. | ||
## sc.registerListener({onEntry : function(stateId){}, onExit : function(stateId){}, onTransition : function(sourceStateId,[targetStateIds,...]){}, onError: function(errorInfo){}}) | ||
This is an alternative interface to `on`. | ||
```html | ||
<html> | ||
<head> | ||
<script src="http://cdnjs.cloudflare.com/ajax/libs/es5-shim/1.2.4/es5-shim.min.js"></script> | ||
<script src="bower_components/scion-core/dist/scion.min.js"></script> | ||
</head> | ||
<body> | ||
<div id="rect"/> | ||
<script> | ||
//declare the your statechart model, same as before | ||
var firstEvent, | ||
eventStamp, | ||
rectNode = document.getElementById('rect'), | ||
rectX = 0, | ||
rectY = 0; | ||
## sc.getConfiguration() : String[] | ||
var statechartModel = { | ||
states : [ | ||
{ | ||
id : 'idle', | ||
onEntry : function(){ | ||
rectNode.textContent='idle'; | ||
}, | ||
transitions : [ | ||
{ | ||
event : 'mousedown', | ||
target : 'dragging', | ||
onTransition : function(event){ | ||
eventStamp = firstEvent = event.data; | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
id : 'dragging', | ||
onEntry : function(){ | ||
rectNode.textContent='dragging'; | ||
}, | ||
transitions : [ | ||
{ | ||
event : 'mouseup', | ||
target : 'idle' | ||
}, | ||
{ | ||
event : 'mousemove', | ||
target : 'dragging', | ||
onTransition : function(event){ | ||
var dx = eventStamp.clientX - event.data.clientX; | ||
var dy = eventStamp.clientY - event.data.clientY; | ||
Returns current state machine ***configuration***, the set of basic states in which the state machine resides. | ||
rectNode.style.left = (rectX -= dx) + 'px'; | ||
rectNode.style.top = (rectY -= dy) + 'px'; | ||
eventStamp = event.data; | ||
} | ||
} | ||
] | ||
} | ||
] | ||
}; | ||
## sc.getFullConfiguration() : String[] | ||
//instantiate the interpreter | ||
var interpreter = new scion.Statechart(statechartModel); | ||
Returns current state machine ***full configuration***, the set of basic states in which the state machine resides, and the hierarchical ancestors of those basic states. | ||
//start the interpreter | ||
interpreter.start(); | ||
## sc.isIn(String : stateId) : Boolean | ||
function handleEvent(e){ | ||
e.preventDefault(); | ||
interpreter.gen({name : e.type,data: e}); | ||
} | ||
Returns true if the state machine is in state with id `stateId`. | ||
//connect all relevant event listeners | ||
rectNode.addEventListener('mousedown',handleEvent,true); | ||
document.documentElement.addEventListener('mouseup',handleEvent,true); | ||
document.documentElement.addEventListener('mousemove',handleEvent,true); | ||
## sc.isFinal() : Boolean | ||
Returns true, if the state machine is in a final state. Otherwise, returns false. | ||
</script> | ||
</body> | ||
</html> | ||
``` | ||
## sc.getSnapshot() : Snapshot | ||
Returns a `snapshot` object, of the form : | ||
``` | ||
[ | ||
configuration, | ||
history, | ||
isInFinalState, | ||
dataModel | ||
] | ||
``` | ||
The 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.Statechart(model, {snapshot : snapshot})`. | ||
@@ -506,79 +388,199 @@ # Statecharts Model Schema | ||
# API | ||
## new scion.Statechart(model) | ||
# Quickstart and Simple Use Case | ||
The SCXML constructor creates an interpreter instance from a model object. | ||
Let's start with the simple example of drag-and-drop behaviour in the browser. You can run this demo live on jsfiddle [here](http://jsfiddle.net/jbeard4/MDkLe/11/). | ||
An entity that can be dragged has two states: idle and dragging. If the entity is in an idle state, and it receives a mousedown event, then it starts dragging. While dragging, if it receives a mousemove event, then it changes its position. Also while dragging, when it receives a mouseup event, it returns to the idle state. | ||
This natural-language description of behaviour can be described using the following simple state machine: | ||
![Drag and Drop](http://jbeard4.github.com/SCION/img/drag_and_drop.png) | ||
This state machine could be written in SCION-CORE's JSON syntax as follows: | ||
```javascript | ||
//same model can be used to create multiple interpreter instances | ||
var sc1 = new scion.Statechart(model), | ||
sc2 = new scion.Statechart(model); | ||
{ | ||
"states" : [ | ||
{ | ||
"id" : "idle", | ||
"transitions" : [ | ||
{ | ||
"event" : "mousedown", | ||
"target" : "dragging", | ||
} | ||
] | ||
}, | ||
{ | ||
"id" : "dragging", | ||
"transitions" : [ | ||
{ | ||
"event" : "mouseup", | ||
"target" : "idle", | ||
}, | ||
{ | ||
"event" : "mousemove", | ||
"target" : "dragging" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
``` | ||
## sc.start() : `<String>`[] | ||
One can add action code in order to script an HTML DOM element, so as to change its position on mousemove events: | ||
`sc.start` starts the SCION-CORE interpreter. `sc.start` should only be called once, and should be called before `sc.gen` is called for the first time. | ||
```javascript | ||
//declare the your statechart model, same as before | ||
var firstEvent, | ||
eventStamp, | ||
rectNode = document.getElementById('rect'), | ||
rectX = 0, | ||
rectY = 0; | ||
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 `sc.start` completes. | ||
var statechartModel = { | ||
states : [ | ||
{ | ||
id : 'idle', | ||
onEntry : function(){ | ||
rectNode.textContent='idle'; | ||
}, | ||
transitions : [ | ||
{ | ||
event : 'mousedown', | ||
target : 'dragging', | ||
onTransition : function(event){ | ||
eventStamp = firstEvent = event.data; | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
id : 'dragging', | ||
onEntry : function(){ | ||
rectNode.textContent='dragging'; | ||
}, | ||
transitions : [ | ||
{ | ||
event : 'mouseup', | ||
target : 'idle' | ||
}, | ||
{ | ||
event : 'mousemove', | ||
target : 'dragging', | ||
onTransition : function(event){ | ||
var dx = eventStamp.clientX - event.data.clientX; | ||
var dy = eventStamp.clientY - event.data.clientY; | ||
## sc.gen(String eventName, Object eventData) : `<String>`[] | ||
## sc.gen({name : String, data : Object}) : `<String>`[] | ||
rectNode.style.left = (rectX -= dx) + 'px'; | ||
rectNode.style.top = (rectY -= dy) + 'px'; | ||
eventStamp = event.data; | ||
} | ||
} | ||
] | ||
} | ||
] | ||
}; | ||
``` | ||
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. | ||
You can then perform the following steps to script web content: | ||
`sc.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 `sc.gen` completes. | ||
1. Use the statecharts model object to instantiate the SCXML interpreter. | ||
2. Connect relevant event listeners to the SCXML interpreter. | ||
3. Call the `start` method on the SCXML interpreter to start execution of the statechart. | ||
```javascript | ||
var sc = new scion.Statechart(model), | ||
var data = {foo:1}; | ||
var configuration = sc.gen("eventName",data); | ||
```html | ||
<html> | ||
<head> | ||
<script src="http://cdnjs.cloudflare.com/ajax/libs/es5-shim/1.2.4/es5-shim.min.js"></script> | ||
<script src="bower_components/scion-core/dist/scion.min.js"></script> | ||
</head> | ||
<body> | ||
<div id="rect"/> | ||
<script> | ||
//declare the your statechart model, same as before | ||
var firstEvent, | ||
eventStamp, | ||
rectNode = document.getElementById('rect'), | ||
rectX = 0, | ||
rectY = 0; | ||
//the following call is equivalent | ||
var configuration = sc.gen({name:"eventName",data:{foo:1}}); | ||
``` | ||
var statechartModel = { | ||
states : [ | ||
{ | ||
id : 'idle', | ||
onEntry : function(){ | ||
rectNode.textContent='idle'; | ||
}, | ||
transitions : [ | ||
{ | ||
event : 'mousedown', | ||
target : 'dragging', | ||
onTransition : function(event){ | ||
eventStamp = firstEvent = event.data; | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
id : 'dragging', | ||
onEntry : function(){ | ||
rectNode.textContent='dragging'; | ||
}, | ||
transitions : [ | ||
{ | ||
event : 'mouseup', | ||
target : 'idle' | ||
}, | ||
{ | ||
event : 'mousemove', | ||
target : 'dragging', | ||
onTransition : function(event){ | ||
var dx = eventStamp.clientX - event.data.clientX; | ||
var dy = eventStamp.clientY - event.data.clientY; | ||
## Event Emitter | ||
rectNode.style.left = (rectX -= dx) + 'px'; | ||
rectNode.style.top = (rectY -= dy) + 'px'; | ||
eventStamp = event.data; | ||
} | ||
} | ||
] | ||
} | ||
] | ||
}; | ||
SCION-CORE includes the [tiny-events](https://github.com/ZauberNerd/tiny-events) library, and implements the following EventEmitter methods: | ||
//instantiate the interpreter | ||
var interpreter = new scion.Statechart(statechartModel); | ||
* on(type: string, listener: Function): EventEmitter | ||
* once(type: string, listener: Function): EventEmitter | ||
* off(type: string, listener?: Function): EventEmitter | ||
* emit(type: string, ...args: any[]): EventEmitter | ||
//start the interpreter | ||
interpreter.start(); | ||
SCION-CORE emits the following events: | ||
function handleEvent(e){ | ||
e.preventDefault(); | ||
interpreter.gen({name : e.type,data: e}); | ||
} | ||
* onEntry | ||
* onExit | ||
* onTransition | ||
* onBigStepBegin | ||
* onBigStepSuspend | ||
* onBigStepResume | ||
* onSmallStepBegin | ||
* onSmallStepEnd | ||
* onBigStepEnd | ||
* onError | ||
//connect all relevant event listeners | ||
rectNode.addEventListener('mousedown',handleEvent,true); | ||
document.documentElement.addEventListener('mouseup',handleEvent,true); | ||
document.documentElement.addEventListener('mousemove',handleEvent,true); | ||
The `onError` callback receives an object containing the following properties: | ||
* `tagname` - The name of the element that produced the error. | ||
* `line` - The line in the source file in which the error occurred. | ||
* `column` - The column in the source file in which the error occurred. | ||
* `reason` - An informative error message. The text is platform-specific and subject to change. | ||
</script> | ||
</body> | ||
</html> | ||
``` | ||
## sc.registerListener({onEntry : function(stateId){}, onExit : function(stateId){}, onTransition : function(sourceStateId,[targetStateIds,...]){}, onError: function(errorInfo){}}) | ||
This is an alternative interface to `on`. | ||
# Development | ||
* Build: `grunt build` | ||
* Run tests: `grunt test` | ||
* Release : `grunt release` | ||
# Build Status | ||
# Support | ||
[![Build status](https://travis-ci.org/jbeard4/SCION-CORE.svg?branch=master)](https://travis-ci.org/jbeard4/SCION-CORE) | ||
[Mailing list](https://groups.google.com/group/scion-dev) | ||
[![Sauce Test Status](https://saucelabs.com/buildstatus/jbeard4?branch=master)](https://saucelabs.com/u/jbeard4) | ||
[![Sauce Test Status](https://saucelabs.com/browser-matrix/jbeard4.svg?branch=master)](https://saucelabs.com/u/jbeard4) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
585
6
832342
222
19099