Comparing version 2.0.0 to 2.0.1
/*! | ||
* * 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.0 | ||
* * Version: v2.0.1 | ||
* * Url: http://machina-js.org/ | ||
@@ -62,3 +62,3 @@ * * License(s): | ||
/* 0 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -78,11 +78,11 @@ var _ = __webpack_require__( 1 ); | ||
/***/ }, | ||
/***/ }), | ||
/* 1 */ | ||
/***/ function(module, exports) { | ||
/***/ (function(module, exports) { | ||
module.exports = __WEBPACK_EXTERNAL_MODULE_1__; | ||
/***/ }, | ||
/***/ }), | ||
/* 2 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -167,5 +167,5 @@ var utils = __webpack_require__( 3 ); | ||
/***/ }, | ||
/***/ }), | ||
/* 3 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -369,5 +369,5 @@ var slice = [].slice; | ||
/***/ }, | ||
/***/ }), | ||
/* 4 */ | ||
/***/ function(module, exports) { | ||
/***/ (function(module, exports) { | ||
@@ -387,5 +387,5 @@ module.exports = { | ||
/***/ }, | ||
/***/ }), | ||
/* 5 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -480,5 +480,5 @@ var BehavioralFsm = __webpack_require__( 6 ); | ||
/***/ }, | ||
/***/ }), | ||
/* 6 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -660,4 +660,4 @@ var _ = __webpack_require__( 1 ); | ||
newStateObj._onEnter.apply( this, this.getSystemHandlerArgs( args, client ) ); | ||
this.emit( events.TRANSITIONED, eventPayload ); | ||
} | ||
this.emit( events.TRANSITIONED, eventPayload ); | ||
if ( child ) { | ||
@@ -741,6 +741,6 @@ child.handle( client, "_reset" ); | ||
/***/ } | ||
/***/ }) | ||
/******/ ]) | ||
}); | ||
; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay91bml2ZXJzYWxNb2R1bGVEZWZpbml0aW9uIiwid2VicGFjazovLy93ZWJwYWNrL2Jvb3RzdHJhcCBmYjkzODgzNmEwNGY2Y2Y0NTkzZSIsIndlYnBhY2s6Ly8vLi9zcmMvbWFjaGluYS5qcyIsIndlYnBhY2s6Ly8vZXh0ZXJuYWwge1wicm9vdFwiOlwiX1wiLFwiY29tbW9uanNcIjpcImxvZGFzaFwiLFwiY29tbW9uanMyXCI6XCJsb2Rhc2hcIixcImFtZFwiOlwibG9kYXNoXCJ9Iiwid2VicGFjazovLy8uL3NyYy9lbWl0dGVyLmpzIiwid2VicGFjazovLy8uL3NyYy91dGlscy5qcyIsIndlYnBhY2s6Ly8vLi9zcmMvZXZlbnRzLmpzIiwid2VicGFjazovLy8uL3NyYy9Gc20uanMiLCJ3ZWJwYWNrOi8vLy4vc3JjL0JlaGF2aW9yYWxGc20uanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLENBQUM7QUFDRCxPO0FDVkE7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0EsdUJBQWU7QUFDZjtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7O0FBR0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTs7Ozs7OztBQ3RDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQT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ZXh0ZW5kO1xuXG5tb2R1bGUuZXhwb3J0cyA9IEJlaGF2aW9yYWxGc207XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL3NyYy9CZWhhdmlvcmFsRnNtLmpzXG4vLyBtb2R1bGUgaWQgPSA2XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJzb3VyY2VSb290IjoiIn0= |
@@ -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))},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.0", | ||
"version": "2.0.1", | ||
"homepage": "http://machina-js.org/", | ||
@@ -6,0 +6,0 @@ "repository": { |
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
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
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
230320
1