-
Notifications
You must be signed in to change notification settings - Fork 4
/
pastafarian.min.js
1 lines (1 loc) · 1.06 KB
/
pastafarian.min.js
1
!function(n){function t(n,t){var e=Error.call(this,"Transition from "+n+" to "+t+" is not allowed");return e.name="IllegalTransitionException",e.prev=n,e.attempt=t,e}function e(n){function e(n){if("function"!=typeof i.error)throw n[0];i.error.apply(this,n)}function r(n,t){if(n in o)for(var r=0;r<o[n].length;++r)try{o[n][r].apply(this,t)}catch(i){e([i])}}var o={},i={transitions:n.states,current:n.initial,error:n.error};return i.bind=function(n,t){return o[n]=o[n]||[],o[n]=o[n].concat(t),i},i.unbind=function(n,t){return n in o&&o[n].indexOf(t)>-1&&o[n].splice(o[n].indexOf(t),1),i},i.on=i.bind,i.go=function(n){var o=i.current,c=Array.prototype.slice.call(arguments,1);return i.transitions[o].indexOf(n)>-1?(r("after:"+o,[n].concat(c)),r("before:"+n,[o].concat(c)),i.current=n,r(n,[o].concat(c)),r("*",[o,n].concat(c))):e([new t(o,n),o,n].concat(c)),i},i}"function"==typeof define&&"object"==typeof define.amd&&define.amd?define(function(){return e}):"object"==typeof module&&module.exports?module.exports=e:"undefined"!=typeof self?self.StateMachine=e:n.StateMachine=e}(this);