Comparing version 2.0.1 to 2.0.2
@@ -0,1 +1,5 @@ | ||
### v2.0.1 | ||
* Fixed issue where the transitioned event was only firing if the state had handlers. (Fixes #137) | ||
### v2.0.0 | ||
@@ -2,0 +6,0 @@ |
/*! | ||
* * machina - A library for creating powerful and flexible finite state machines. Loosely inspired by Erlang/OTP's gen_fsm behavior. | ||
* * Author: Jim Cowart (http://ifandelse.com) | ||
* * Version: v2.0.1 | ||
* * Version: v2.0.2 | ||
* * Url: http://machina-js.org/ | ||
@@ -703,3 +703,3 @@ * * License(s): | ||
this.handle.apply( this, [ client ].concat( item.args ) ); | ||
}, this ); | ||
}.bind( this ) ); | ||
}, | ||
@@ -739,2 +739,2 @@ | ||
; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay91bml2ZXJzYWxNb2R1bGVEZWZpbml0aW9uIiwid2VicGFjazovLy93ZWJwYWNrL2Jvb3RzdHJhcCBlMDBiMWZmN2M5ZjQwZmFiOGZhMCIsIndlYnBhY2s6Ly8vLi9zcmMvbWFjaGluYS5qcyIsIndlYnBhY2s6Ly8vZXh0ZXJuYWwge1wicm9vdFwiOlwiX1wiLFwiY29tbW9uanNcIjpcImxvZGFzaFwiLFwiY29tbW9uanMyXCI6XCJsb2Rhc2hcIixcImFtZFwiOlwibG9kYXNoXCJ9Iiwid2VicGFjazovLy8uL3NyYy9lbWl0dGVyLmpzIiwid2VicGFjazovLy8uL3NyYy91dGlscy5qcyIsIndlYnBhY2s6Ly8vLi9zcmMvZXZlbnRzLmpzIiwid2VicGFjazovLy8uL3NyYy9Gc20uanMiLCJ3ZWJwYWNrOi8vLy4vc3JjL0JlaGF2aW9yYWxGc20uanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBL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dHN0YXRlICs9IFwiLlwiICsgY2hpbGQuY29tcG9zaXRlU3RhdGUoIGNsaWVudCApO1xuXHRcdH1cblx0XHRyZXR1cm4gc3RhdGU7XG5cdH1cbn0sIGVtaXR0ZXIuZ2V0SW5zdGFuY2UoKSApO1xuXG5CZWhhdmlvcmFsRnNtLmV4dGVuZCA9IHV0aWxzLmV4dGVuZDtcblxubW9kdWxlLmV4cG9ydHMgPSBCZWhhdmlvcmFsRnNtO1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9zcmMvQmVoYXZpb3JhbEZzbS5qc1xuLy8gbW9kdWxlIGlkID0gNlxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwic291cmNlUm9vdCI6IiJ9 |
@@ -1,2 +0,2 @@ | ||
(function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("lodash")):"function"==typeof define&&define.amd?define(["lodash"],e):"object"==typeof exports?exports.machina=e(require("lodash")):t.machina=e(t._)})(this,function(t){return function(t){function e(i){if(n[i])return n[i].exports;var s=n[i]={exports:{},id:i,loaded:!1};return t[i].call(s.exports,s,s.exports,e),s.loaded=!0,s.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){var i=n(1),s=n(2);t.exports=i.merge(s.instance,{Fsm:n(5),BehavioralFsm:n(6),utils:n(3),eventListeners:{newFsm:[]}})},function(e,n){e.exports=t},function(t,e,n){function i(){return{emit:function(t){var e=s.getLeaklessArgs(arguments);this.eventListeners["*"]&&a.each(this.eventListeners["*"],function(t){if(this.useSafeEmit)try{t.apply(this,e)}catch(n){console&&"undefined"!=typeof console.log&&console.log(n.stack)}else t.apply(this,e)},this),this.eventListeners[t]&&a.each(this.eventListeners[t],function(t){if(this.useSafeEmit)try{t.apply(this,e.slice(1))}catch(n){console&&"undefined"!=typeof console.log&&console.log(n.stack)}else t.apply(this,e.slice(1))},this)},on:function(t,e){var n=this;return n.eventListeners=n.eventListeners||{"*":[]},n.eventListeners[t]||(n.eventListeners[t]=[]),n.eventListeners[t].push(e),{eventName:t,callback:e,off:function(){n.off(t,e)}}},off:function(t,e){this.eventListeners=this.eventListeners||{"*":[]},t?this.eventListeners[t]=e?a.without(this.eventListeners[t],e):[]:this.eventListeners={}}}}var s=n(3),a=n(1);t.exports={getInstance:i,instance:i()}},function(t,e,n){function i(){return{initialState:"uninitialized",eventListeners:{"*":[]},states:{},namespace:h(),useSafeEmit:!1,hierarchy:{},pendingDelegations:{}}}function s(){return{inputQueue:[],targetReplayState:"",state:void 0,priorState:void 0,priorAction:"",currentAction:"",currentActionArgs:void 0,inExitHandler:!1}}function a(t,e){for(var n=[],i=e||0;i<t.length;i++)n[i]=t[i];return n}function r(t){if(t){var e={};return"object"==typeof t?t.factory?(e=t,e.instance=e.factory()):e.factory=function(){return t}:"function"==typeof t&&(e.factory=t),e.instance=e.factory(),e}}function o(t,e){return e.on("*",function(e,n){switch(e){case l.NO_HANDLER:n.ticket||n.delegated||n.namespace===t.namespace||(n.args[1].bubbling=!0),"_reset"!==n.inputType&&t.handle.apply(t,n.args);break;case l.HANDLING:var i=n.ticket;i&&t.pendingDelegations[i]&&delete t.pendingDelegations[i],t.emit(e,n);break;default:t.emit(e,n)}})}function c(){for(var t=[],e="0123456789abcdef",n=0;36>n;n++)t[n]=e.substr(Math.floor(16*Math.random()),1);return t[14]="4",t[19]=e.substr(3&t[19]|8,1),t[8]=t[13]=t[18]=t[23]="-",t.join("")}var u=[].slice,l=n(4),p=n(1),h=function(){var t=0;return function(){return"fsm."+t++}}(),f=["states","initialState"],d=function(t,e){var n,i=this,s={},a=function(){};return n=t&&t.hasOwnProperty("constructor")?t.constructor:function(){var t=u.call(arguments,0);t[0]=t[0]||{};var e,n=t[0].states||{};e=p.merge(p.cloneDeep(s),{states:n}),e.initialState=t[0].initialState||this.initialState,p.extend(t[0],e),i.apply(this,t)},p.merge(n,i),a.prototype=i.prototype,n.prototype=new a,t&&(p.extend(n.prototype,t),p.merge(s,p.transform(t,function(t,e,n){-1!==f.indexOf(n)&&(t[n]=e)}))),e&&p.merge(n,e),n.prototype.constructor=n,n.__super__=i.prototype,n};t.exports={createUUID:c,extend:d,getDefaultBehavioralOptions:i,getDefaultOptions:i,getDefaultClientMeta:s,getChildFsmInstance:r,getLeaklessArgs:a,listenToChild:o,makeFsmNamespace:h}},function(t,e){t.exports={NEXT_TRANSITION:"transition",HANDLING:"handling",HANDLED:"handled",NO_HANDLER:"nohandler",TRANSITION:"transition",TRANSITIONED:"transitioned",INVALID_STATE:"invalidstate",DEFERRED:"deferred",NEW_FSM:"newfsm"}},function(t,e,n){var i=n(6),s=n(3),a=n(1),r={constructor:function(){i.apply(this,arguments),this.ensureClientMeta()},initClient:function(){var t=this.initialState;if(!t)throw new Error("You must specify an initial state for this FSM");if(!this.states[t])throw new Error("The initial state specified does not exist in the states object.");this.transition(t)},ensureClientMeta:function(){return this._stamped||(this._stamped=!0,a.defaults(this,a.cloneDeep(s.getDefaultClientMeta())),this.initClient()),this},ensureClientArg:function(t){var e=t;return"object"!=typeof e[0]||"inputType"in e[0]||e[0]===this?("object"!=typeof e[0]||"object"==typeof e[0]&&"inputType"in e[0])&&e.unshift(this):e.splice(0,1,this),e},getHandlerArgs:function(t,e){var n=t,i=n[1];return"object"==typeof inputType&&n.splice(1,1,i.inputType),n.slice(e?1:2)},getSystemHandlerArgs:function(t,e){return t},buildEventPayload:function(){var t=this.ensureClientArg(s.getLeaklessArgs(arguments)),e=t[1];return a.isPlainObject(e)?a.extend(e,{namespace:this.namespace}):{data:e||null,namespace:this.namespace}}};a.each(["handle","transition","deferUntilTransition","processQueue","clearQueue"],function(t){r[t]=function(){var e=this.ensureClientArg(s.getLeaklessArgs(arguments));return i.prototype[t].apply(this,e)}}),r=i.extend(r),t.exports=r},function(t,e,n){function i(t){s.extend(this,t),s.defaults(this,a.getDefaultBehavioralOptions()),this.initialize.apply(this,arguments),o.emit(c.NEW_FSM,this)}var s=n(1),a=n(3),r=n(2),o=r.instance,c=n(4),u="__machina__";s.extend(i.prototype,{initialize:function(){},initClient:function(t){var e=this.initialState;if(!e)throw new Error("You must specify an initial state for this FSM");if(!this.states[e])throw new Error("The initial state specified does not exist in the states object.");this.transition(t,e)},configForState:function(t){var e,n=this.states[t];return s.each(this.hierarchy,function(t,e){t&&"function"==typeof t.off&&t.off()}),n._child&&(n._child=a.getChildFsmInstance(n._child),e=n._child&&n._child.instance,this.hierarchy[e.namespace]=a.listenToChild(this,e)),e},ensureClientMeta:function(t){if("object"!=typeof t)throw new Error("An FSM client must be an object.");return t[u]=t[u]||{},t[u][this.namespace]||(t[u][this.namespace]=s.cloneDeep(a.getDefaultClientMeta()),this.initClient(t)),t[u][this.namespace]},buildEventPayload:function(t,e){return s.isPlainObject(e)?s.extend(e,{client:t,namespace:this.namespace}):{client:t,data:e||null,namespace:this.namespace}},getHandlerArgs:function(t,e){var n=t.slice(0),i=n[1];return"object"==typeof i&&n.splice(1,1,i.inputType),e?n:[n[0]].concat(n.slice(2))},getSystemHandlerArgs:function(t,e){return[e].concat(t)},handle:function(t,e){var n=e;if("undefined"==typeof e)throw new Error("The input argument passed to the FSM's handle method is undefined. Did you forget to pass the input name?");"string"==typeof e&&(n={inputType:e,delegated:!1,ticket:void 0});var i=this.ensureClientMeta(t),r=a.getLeaklessArgs(arguments);"object"!=typeof e&&r.splice(1,1,n),i.currentActionArgs=r.slice(1);var o,u,l,p,h,f=i.state,d=this.states[f],g=!1;if(!i.inExitHandler)if(l=this.configForState(f),!l||this.pendingDelegations[n.ticket]||n.bubbling){n.ticket&&this.pendingDelegations[n.ticket]&&delete this.pendingDelegations[n.ticket],o=d[n.inputType]?n.inputType:"*",g="*"===o,u=d[o]||this[o]||this["*"],h=i.state+"."+o,i.currentAction=h;var m=this.buildEventPayload(t,{inputType:n.inputType,delegated:n.delegated,ticket:n.ticket});u?(this.emit(c.HANDLING,m),"function"==typeof u?p=u.apply(this,this.getHandlerArgs(r,g)):(p=u,this.transition(t,u)),this.emit(c.HANDLED,m)):this.emit(c.NO_HANDLER,s.extend({args:r},m)),i.priorAction=i.currentAction,i.currentAction="",i.currentActionArgs=void 0}else n.ticket=n.ticket||a.createUUID(),n.delegated=!0,this.pendingDelegations[n.ticket]={delegatedTo:l.namespace},p=l.handle.apply(l,r);return p},transition:function(t,e){var n,i=this.ensureClientMeta(t),s=i.state,r=this.states[s],o=this.states[e],u=a.getLeaklessArgs(arguments).slice(2);if(!i.inExitHandler&&e!==s){if(o){n=this.configForState(e),r&&r._onExit&&(i.inExitHandler=!0,r._onExit.call(this,t),i.inExitHandler=!1),i.targetReplayState=e,i.priorState=s,i.state=e;var l=this.buildEventPayload(t,{fromState:i.priorState,action:i.currentAction,toState:e});return this.emit(c.TRANSITION,l),o._onEnter&&o._onEnter.apply(this,this.getSystemHandlerArgs(u,t)),this.emit(c.TRANSITIONED,l),n&&n.handle(t,"_reset"),void(i.targetReplayState===e&&this.processQueue(t,c.NEXT_TRANSITION))}this.emit(c.INVALID_STATE,this.buildEventPayload(t,{state:i.state,attemptedState:e}))}},deferUntilTransition:function(t,e){var n=this.ensureClientMeta(t);if(n.currentActionArgs){var i={type:c.NEXT_TRANSITION,untilState:e,args:n.currentActionArgs};n.inputQueue.push(i);var s=this.buildEventPayload(t,{state:n.state,queuedArgs:i});this.emit(c.DEFERRED,s)}},deferAndTransition:function(t,e){this.deferUntilTransition(t,e),this.transition(t,e)},processQueue:function(t){var e=this.ensureClientMeta(t),n=function(t){return!t.untilState||t.untilState===e.state},i=s.filter(e.inputQueue,n);e.inputQueue=s.difference(e.inputQueue,i),s.each(i,function(e){this.handle.apply(this,[t].concat(e.args))},this)},clearQueue:function(t,e){var n=this.ensureClientMeta(t);if(e){var i=function(t){return e?t.untilState!==e:!0};n.inputQueue=s.filter(n.inputQueue,i)}else n.inputQueue=[]},compositeState:function(t){var e=this.ensureClientMeta(t),n=e.state,i=this.states[n]._child&&this.states[n]._child.instance;return i&&(n+="."+i.compositeState(t)),n}},r.getInstance()),i.extend=a.extend,t.exports=i}])}); | ||
(function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("lodash")):"function"==typeof define&&define.amd?define(["lodash"],e):"object"==typeof exports?exports.machina=e(require("lodash")):t.machina=e(t._)})(this,function(t){return function(t){function e(i){if(n[i])return n[i].exports;var s=n[i]={exports:{},id:i,loaded:!1};return t[i].call(s.exports,s,s.exports,e),s.loaded=!0,s.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){var i=n(1),s=n(2);t.exports=i.merge(s.instance,{Fsm:n(5),BehavioralFsm:n(6),utils:n(3),eventListeners:{newFsm:[]}})},function(e,n){e.exports=t},function(t,e,n){function i(){return{emit:function(t){var e=s.getLeaklessArgs(arguments);this.eventListeners["*"]&&a.each(this.eventListeners["*"],function(t){if(this.useSafeEmit)try{t.apply(this,e)}catch(n){console&&"undefined"!=typeof console.log&&console.log(n.stack)}else t.apply(this,e)},this),this.eventListeners[t]&&a.each(this.eventListeners[t],function(t){if(this.useSafeEmit)try{t.apply(this,e.slice(1))}catch(n){console&&"undefined"!=typeof console.log&&console.log(n.stack)}else t.apply(this,e.slice(1))},this)},on:function(t,e){var n=this;return n.eventListeners=n.eventListeners||{"*":[]},n.eventListeners[t]||(n.eventListeners[t]=[]),n.eventListeners[t].push(e),{eventName:t,callback:e,off:function(){n.off(t,e)}}},off:function(t,e){this.eventListeners=this.eventListeners||{"*":[]},t?this.eventListeners[t]=e?a.without(this.eventListeners[t],e):[]:this.eventListeners={}}}}var s=n(3),a=n(1);t.exports={getInstance:i,instance:i()}},function(t,e,n){function i(){return{initialState:"uninitialized",eventListeners:{"*":[]},states:{},namespace:h(),useSafeEmit:!1,hierarchy:{},pendingDelegations:{}}}function s(){return{inputQueue:[],targetReplayState:"",state:void 0,priorState:void 0,priorAction:"",currentAction:"",currentActionArgs:void 0,inExitHandler:!1}}function a(t,e){for(var n=[],i=e||0;i<t.length;i++)n[i]=t[i];return n}function r(t){if(t){var e={};return"object"==typeof t?t.factory?(e=t,e.instance=e.factory()):e.factory=function(){return t}:"function"==typeof t&&(e.factory=t),e.instance=e.factory(),e}}function o(t,e){return e.on("*",function(e,n){switch(e){case l.NO_HANDLER:n.ticket||n.delegated||n.namespace===t.namespace||(n.args[1].bubbling=!0),"_reset"!==n.inputType&&t.handle.apply(t,n.args);break;case l.HANDLING:var i=n.ticket;i&&t.pendingDelegations[i]&&delete t.pendingDelegations[i],t.emit(e,n);break;default:t.emit(e,n)}})}function c(){for(var t=[],e="0123456789abcdef",n=0;36>n;n++)t[n]=e.substr(Math.floor(16*Math.random()),1);return t[14]="4",t[19]=e.substr(3&t[19]|8,1),t[8]=t[13]=t[18]=t[23]="-",t.join("")}var u=[].slice,l=n(4),p=n(1),h=function(){var t=0;return function(){return"fsm."+t++}}(),f=["states","initialState"],d=function(t,e){var n,i=this,s={},a=function(){};return n=t&&t.hasOwnProperty("constructor")?t.constructor:function(){var t=u.call(arguments,0);t[0]=t[0]||{};var e,n=t[0].states||{};e=p.merge(p.cloneDeep(s),{states:n}),e.initialState=t[0].initialState||this.initialState,p.extend(t[0],e),i.apply(this,t)},p.merge(n,i),a.prototype=i.prototype,n.prototype=new a,t&&(p.extend(n.prototype,t),p.merge(s,p.transform(t,function(t,e,n){-1!==f.indexOf(n)&&(t[n]=e)}))),e&&p.merge(n,e),n.prototype.constructor=n,n.__super__=i.prototype,n};t.exports={createUUID:c,extend:d,getDefaultBehavioralOptions:i,getDefaultOptions:i,getDefaultClientMeta:s,getChildFsmInstance:r,getLeaklessArgs:a,listenToChild:o,makeFsmNamespace:h}},function(t,e){t.exports={NEXT_TRANSITION:"transition",HANDLING:"handling",HANDLED:"handled",NO_HANDLER:"nohandler",TRANSITION:"transition",TRANSITIONED:"transitioned",INVALID_STATE:"invalidstate",DEFERRED:"deferred",NEW_FSM:"newfsm"}},function(t,e,n){var i=n(6),s=n(3),a=n(1),r={constructor:function(){i.apply(this,arguments),this.ensureClientMeta()},initClient:function(){var t=this.initialState;if(!t)throw new Error("You must specify an initial state for this FSM");if(!this.states[t])throw new Error("The initial state specified does not exist in the states object.");this.transition(t)},ensureClientMeta:function(){return this._stamped||(this._stamped=!0,a.defaults(this,a.cloneDeep(s.getDefaultClientMeta())),this.initClient()),this},ensureClientArg:function(t){var e=t;return"object"!=typeof e[0]||"inputType"in e[0]||e[0]===this?("object"!=typeof e[0]||"object"==typeof e[0]&&"inputType"in e[0])&&e.unshift(this):e.splice(0,1,this),e},getHandlerArgs:function(t,e){var n=t,i=n[1];return"object"==typeof inputType&&n.splice(1,1,i.inputType),n.slice(e?1:2)},getSystemHandlerArgs:function(t,e){return t},buildEventPayload:function(){var t=this.ensureClientArg(s.getLeaklessArgs(arguments)),e=t[1];return a.isPlainObject(e)?a.extend(e,{namespace:this.namespace}):{data:e||null,namespace:this.namespace}}};a.each(["handle","transition","deferUntilTransition","processQueue","clearQueue"],function(t){r[t]=function(){var e=this.ensureClientArg(s.getLeaklessArgs(arguments));return i.prototype[t].apply(this,e)}}),r=i.extend(r),t.exports=r},function(t,e,n){function i(t){s.extend(this,t),s.defaults(this,a.getDefaultBehavioralOptions()),this.initialize.apply(this,arguments),o.emit(c.NEW_FSM,this)}var s=n(1),a=n(3),r=n(2),o=r.instance,c=n(4),u="__machina__";s.extend(i.prototype,{initialize:function(){},initClient:function(t){var e=this.initialState;if(!e)throw new Error("You must specify an initial state for this FSM");if(!this.states[e])throw new Error("The initial state specified does not exist in the states object.");this.transition(t,e)},configForState:function(t){var e,n=this.states[t];return s.each(this.hierarchy,function(t,e){t&&"function"==typeof t.off&&t.off()}),n._child&&(n._child=a.getChildFsmInstance(n._child),e=n._child&&n._child.instance,this.hierarchy[e.namespace]=a.listenToChild(this,e)),e},ensureClientMeta:function(t){if("object"!=typeof t)throw new Error("An FSM client must be an object.");return t[u]=t[u]||{},t[u][this.namespace]||(t[u][this.namespace]=s.cloneDeep(a.getDefaultClientMeta()),this.initClient(t)),t[u][this.namespace]},buildEventPayload:function(t,e){return s.isPlainObject(e)?s.extend(e,{client:t,namespace:this.namespace}):{client:t,data:e||null,namespace:this.namespace}},getHandlerArgs:function(t,e){var n=t.slice(0),i=n[1];return"object"==typeof i&&n.splice(1,1,i.inputType),e?n:[n[0]].concat(n.slice(2))},getSystemHandlerArgs:function(t,e){return[e].concat(t)},handle:function(t,e){var n=e;if("undefined"==typeof e)throw new Error("The input argument passed to the FSM's handle method is undefined. Did you forget to pass the input name?");"string"==typeof e&&(n={inputType:e,delegated:!1,ticket:void 0});var i=this.ensureClientMeta(t),r=a.getLeaklessArgs(arguments);"object"!=typeof e&&r.splice(1,1,n),i.currentActionArgs=r.slice(1);var o,u,l,p,h,f=i.state,d=this.states[f],g=!1;if(!i.inExitHandler)if(l=this.configForState(f),!l||this.pendingDelegations[n.ticket]||n.bubbling){n.ticket&&this.pendingDelegations[n.ticket]&&delete this.pendingDelegations[n.ticket],o=d[n.inputType]?n.inputType:"*",g="*"===o,u=d[o]||this[o]||this["*"],h=i.state+"."+o,i.currentAction=h;var m=this.buildEventPayload(t,{inputType:n.inputType,delegated:n.delegated,ticket:n.ticket});u?(this.emit(c.HANDLING,m),"function"==typeof u?p=u.apply(this,this.getHandlerArgs(r,g)):(p=u,this.transition(t,u)),this.emit(c.HANDLED,m)):this.emit(c.NO_HANDLER,s.extend({args:r},m)),i.priorAction=i.currentAction,i.currentAction="",i.currentActionArgs=void 0}else n.ticket=n.ticket||a.createUUID(),n.delegated=!0,this.pendingDelegations[n.ticket]={delegatedTo:l.namespace},p=l.handle.apply(l,r);return p},transition:function(t,e){var n,i=this.ensureClientMeta(t),s=i.state,r=this.states[s],o=this.states[e],u=a.getLeaklessArgs(arguments).slice(2);if(!i.inExitHandler&&e!==s){if(o){n=this.configForState(e),r&&r._onExit&&(i.inExitHandler=!0,r._onExit.call(this,t),i.inExitHandler=!1),i.targetReplayState=e,i.priorState=s,i.state=e;var l=this.buildEventPayload(t,{fromState:i.priorState,action:i.currentAction,toState:e});return this.emit(c.TRANSITION,l),o._onEnter&&o._onEnter.apply(this,this.getSystemHandlerArgs(u,t)),this.emit(c.TRANSITIONED,l),n&&n.handle(t,"_reset"),void(i.targetReplayState===e&&this.processQueue(t,c.NEXT_TRANSITION))}this.emit(c.INVALID_STATE,this.buildEventPayload(t,{state:i.state,attemptedState:e}))}},deferUntilTransition:function(t,e){var n=this.ensureClientMeta(t);if(n.currentActionArgs){var i={type:c.NEXT_TRANSITION,untilState:e,args:n.currentActionArgs};n.inputQueue.push(i);var s=this.buildEventPayload(t,{state:n.state,queuedArgs:i});this.emit(c.DEFERRED,s)}},deferAndTransition:function(t,e){this.deferUntilTransition(t,e),this.transition(t,e)},processQueue:function(t){var e=this.ensureClientMeta(t),n=function(t){return!t.untilState||t.untilState===e.state},i=s.filter(e.inputQueue,n);e.inputQueue=s.difference(e.inputQueue,i),s.each(i,function(e){this.handle.apply(this,[t].concat(e.args))}.bind(this))},clearQueue:function(t,e){var n=this.ensureClientMeta(t);if(e){var i=function(t){return e?t.untilState!==e:!0};n.inputQueue=s.filter(n.inputQueue,i)}else n.inputQueue=[]},compositeState:function(t){var e=this.ensureClientMeta(t),n=e.state,i=this.states[n]._child&&this.states[n]._child.instance;return i&&(n+="."+i.compositeState(t)),n}},r.getInstance()),i.extend=a.extend,t.exports=i}])}); | ||
//# sourceMappingURL=machina.min.js.map |
{ | ||
"name": "machina", | ||
"description": "A library for creating powerful and flexible finite state machines. Loosely inspired by Erlang/OTP's gen_fsm behavior.", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"homepage": "http://machina-js.org/", | ||
@@ -6,0 +6,0 @@ "repository": { |
@@ -13,3 +13,3 @@ # machina v2.0.0-1 | ||
* conditional UI (menus, navigation, workflow) | ||
* initiliazation of node.js processes or single-page-apps | ||
* initialization of node.js processes or single-page-apps | ||
* responding to user input devices (remotes, keyboard, mouse, etc.) | ||
@@ -492,5 +492,4 @@ | ||
##Have More Questions? | ||
## Have More Questions? | ||
Read the [wiki](https://github.com/ifandelse/machina.js/wiki) and the source – you might find your answer and more! Check out the [issue](https://github.com/ifandelse/machina.js/issues/4) opened by @burin - a *great* example of how to use github issues to ask questions, provide sample code, etc. I only ask that if you open an issue, that it be *focused on a specific problem or bug* (not wide-open ambiguity, please). | ||
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
230489
0
494