-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
signals.min.js
1 lines (1 loc) · 15.4 KB
/
signals.min.js
1
var SignalsJS;(()=>{"use strict";var t={769:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.DeluxeSignal=void 0;var o=function(t){function e(e){void 0===e&&(e=null);for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=this;return r=1===r.length&&r[0]instanceof Array?r[0]:r,(i=t.call(this,r)||this)._target=e,i}return i(e,t),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},set:function(t){t!==this._target&&(this.removeAll(),this._target=t)},enumerable:!1,configurable:!0}),e.prototype.dispatch=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=this._valueClasses.length,n=t.length;if(n<r)throw new Error("Incorrect number of arguments. Expected at least "+r+" but received "+n+".");for(var i=0;i<r;i++)if(null!==t[i]&&t[i].constructor!==this._valueClasses[i])throw new Error("Value object <"+t[i]+"> is not an instance of <"+this._valueClasses[i]+">.");var o=t[0];o&&(o.target&&(o=o.clone(),t[0]=o),o.target=this.target,o.currentTarget=this.target,o.signal=this);for(var s=this.slots;s.nonEmpty;)s.head.execute(t),s=s.tail;if(o&&o.bubbles)for(var l=this.target;l&&l.hasOwnProperty("parent")&&(null===(l=l.parent).onEventBubbled||(o.currentTarget=l,l.onEventBubbled(o))););},e}(r(73).PrioritySignal);e.DeluxeSignal=o},43:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IOnceSignal=void 0,e.IOnceSignal=Symbol("IOnceSignal")},1:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IPrioritySignal=void 0,e.IPrioritySignal=Symbol("IPrioritySignal")},579:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ISignal=void 0,e.ISignal=Symbol("ISignal")},234:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ISlot=void 0,e.ISlot=Symbol("ISlot")},418:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MonoSignal=void 0;var n=r(952),i=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.valueClasses=1===t.length&&t[0]instanceof Array?t[0]:t}return Object.defineProperty(t.prototype,"valueClasses",{get:function(){return this._valueClasses},set:function(t){this._valueClasses=t?t.slice():[];for(var e=this._valueClasses.length;e--;)if("function"!=typeof this._valueClasses[e])throw new Error("Invalid valueClasses argument: item at index "+e+" should be a Class but was:<"+this._valueClasses[e]+"'>."+this._valueClasses[e])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"numListeners",{get:function(){return this.slot?1:0},enumerable:!1,configurable:!0}),t.prototype.add=function(t){return this.registerListener(t)},t.prototype.addOnce=function(t){return this.registerListener(t,!0)},t.prototype.remove=function(t){if(this.slot&&this.slot.listener===t){var e=this.slot;return this.slot=null,e}return null},t.prototype.removeAll=function(){this.slot&&this.slot.remove()},t.prototype.dispatch=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=this._valueClasses.length,n=t.length;if(n<r)throw new Error("Incorrect number of arguments. Expected at least "+r+" but received "+n+".");for(var i=0;i<r;i++)if(!(null===t[i]||t[i]instanceof this._valueClasses[i]||t[i].constructor===this._valueClasses[i]))throw new Error("Value object <"+t[i]+"> is not an instance of <"+this._valueClasses[i]+">.");this.slot&&this.slot.execute(t)},t.prototype.registerListener=function(t,e){if(void 0===e&&(e=!1),this.slot)throw new Error("You cannot add or addOnce with a listener already added, remove the current listener first.");return this.slot=new n.Slot(t,this,e)},t}();e.MonoSignal=i},556:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.OnceSignal=void 0;var n=r(602),i=r(952),o=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.slots=n.SlotList.NIL,this.valueClasses=1===t.length&&t[0]instanceof Array?t[0]:t}return Object.defineProperty(t.prototype,"valueClasses",{get:function(){return this._valueClasses},set:function(t){this._valueClasses=t?t.slice():[];for(var e=this._valueClasses.length;e--;)if(!(this._valueClasses[e]instanceof Object))throw new Error("Invalid valueClasses argument: item at index "+e+" should be a Class but was:<"+this._valueClasses[e]+">."+this._valueClasses[e])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"numListeners",{get:function(){return this.slots.length},enumerable:!1,configurable:!0}),t.prototype.addOnce=function(t){return this.registerListener(t,!0)},t.prototype.remove=function(t){var e=this.slots.find(t);return e?(this.slots=this.slots.filterNot(t),e):null},t.prototype.removeAll=function(){this.slots=n.SlotList.NIL},t.prototype.dispatch=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=this._valueClasses.length,n=t.length;if(n<r)throw new Error("Incorrect number of arguments. Expected at least "+r+" but received "+n+".");for(var i=0;i<r;i++)if(!(null===t[i]||t[i]instanceof this._valueClasses[i]||t[i].constructor===this._valueClasses[i]))throw new Error("Value object <"+t[i]+"> is not an instance of <"+this._valueClasses[i]+">.");var o=this.slots;if(o.nonEmpty)for(;o.nonEmpty;)o.head.execute(t),o=o.tail},t.prototype.registerListener=function(t,e){if(void 0===e&&(e=!1),this.registrationPossible(t,e)){var r=new i.Slot(t,this,e);return this.slots=this.slots.prepend(r),r}return this.slots.find(t)},t.prototype.registrationPossible=function(t,e){if(!this.slots.nonEmpty)return!0;var r=this.slots.find(t);if(!r)return!0;if(r.once!==e)throw new Error("You cannot addOnce() then add() the same listener without removing the relationship first.");return!1},t}();e.OnceSignal=o},73:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.PrioritySignal=void 0;var o=r(561),s=r(952),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.addWithPriority=function(t,e){return void 0===e&&(e=0),this.registerListenerWithPriority(t,!1,e)},e.prototype.addOnceWithPriority=function(t,e){return void 0===e&&(e=0),this.registerListenerWithPriority(t,!0,e)},e.prototype.registerListener=function(t,e){return void 0===e&&(e=!1),this.registerListenerWithPriority(t,e)},e.prototype.registerListenerWithPriority=function(t,e,r){if(void 0===r&&(r=0),this.registrationPossible(t,e)){var n=new s.Slot(t,this,e,r);return this.slots=this.slots.insertWithPriority(n),n}return this.slots.find(t)},e}(o.Signal);e.PrioritySignal=l},69:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Promise=void 0;var o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.addOnce=function(e){var r=t.prototype.addOnce.call(this,e);return this.isDispatched&&(r.execute(this.valueObjects),r.remove()),r},e.prototype.dispatch=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];if(this.isDispatched)throw new Error("You cannot dispatch() a Promise more than once");this.isDispatched=!0,this.valueObjects=e,t.prototype.dispatch.apply(this,e)},e}(r(556).OnceSignal);e.Promise=o},561:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Signal=void 0;var o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.add=function(t){return this.registerListener(t)},e}(r(556).OnceSignal);e.Signal=o},952:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Slot=void 0;var r=function(){function t(t,e,r,n){void 0===r&&(r=!1),void 0===n&&(n=0),this._enabled=!0,this._once=!1,this._priority=0,this._listener=t,this._once=r,this._signal=e,this._priority=n,this.verifyListener(t)}return t.prototype.execute0=function(){this._enabled&&(this._once&&this.remove(),this._params&&this._params.length?this._listener.apply(null,this._params):this._listener())},t.prototype.execute1=function(t){this._enabled&&(this._once&&this.remove(),this._params&&this._params.length?this._listener.apply(null,[t].concat(this._params)):this._listener(t))},t.prototype.execute=function(t){if(this._enabled){this._once&&this.remove(),this._params&&this._params.length&&(t=t.concat(this._params));var e=t.length;0===e?this._listener():1===e?this._listener(t[0]):2===e?this._listener(t[0],t[1]):3===e?this._listener(t[0],t[1],t[2]):this._listener.apply(null,t)}},Object.defineProperty(t.prototype,"listener",{get:function(){return this._listener},set:function(t){if(null==t)throw new Error("Given listener is null.\nDid you want to set enabled to false instead?");this.verifyListener(t),this._listener=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"once",{get:function(){return this._once},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"priority",{get:function(){return this._priority},enumerable:!1,configurable:!0}),t.prototype.toString=function(){return"[Slot listener: "+this._listener+", once: "+this._once+", priority: "+this._priority+", enabled: "+this._enabled+"]"},Object.defineProperty(t.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this._enabled=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"params",{get:function(){return this._params},set:function(t){this._params=t},enumerable:!1,configurable:!0}),t.prototype.remove=function(){this._signal.remove(this._listener)},t.prototype.verifyListener=function(t){if(null==t)throw new Error("Given listener is null.");if(null==this._signal)throw new Error("Internal signal reference has not been set yet.")},t}();e.Slot=r},602:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SlotList=void 0;var r=function(){function t(e,r){if(void 0===r&&(r=null),this.nonEmpty=!1,e||r){if(!e)throw new Error("Parameter head cannot be null.");this.head=e,this.tail=r||t.NIL,this.nonEmpty=!0}else{if(t.NIL)throw new Error("Parameters head and tail are null. Use the NIL element instead.");this.nonEmpty=!1}}return Object.defineProperty(t.prototype,"length",{get:function(){if(!this.nonEmpty)return 0;if(this.tail===t.NIL)return 1;for(var e=0,r=this;r.nonEmpty;)++e,r=r.tail;return e},enumerable:!1,configurable:!0}),t.prototype.prepend=function(e){return new t(e,this)},t.prototype.append=function(e){if(!e)return this;if(!this.nonEmpty)return new t(e);if(this.tail===t.NIL)return new t(e).prepend(this.head);for(var r=new t(this.head),n=r,i=this.tail;i.nonEmpty;)n=n.tail=new t(i.head),i=i.tail;return n.tail=new t(e),r},t.prototype.insertWithPriority=function(e){if(!this.nonEmpty)return new t(e);var r=e.priority;if(r>this.head.priority)return this.prepend(e);for(var n=new t(this.head),i=n,o=this.tail;o.nonEmpty;){if(r>o.head.priority)return i.tail=o.prepend(e),n;i=i.tail=new t(o.head),o=o.tail}return i.tail=new t(e),n},t.prototype.filterNot=function(e){if(!this.nonEmpty||null==e)return this;if(e===this.head.listener)return this.tail;for(var r=new t(this.head),n=r,i=this.tail;i.nonEmpty;){if(i.head.listener===e)return n.tail=i.tail,r;n=n.tail=new t(i.head),i=i.tail}return this},t.prototype.contains=function(t){if(!this.nonEmpty)return!1;for(var e=this;e.nonEmpty;){if(e.head.listener===t)return!0;e=e.tail}return!1},t.prototype.find=function(t){if(!this.nonEmpty)return null;for(var e=this;e.nonEmpty;){if(e.head.listener===t)return e.head;e=e.tail}return null},t.prototype.toString=function(){for(var t="",e=this;e.nonEmpty;)t+=e.head+" -> ",e=e.tail;return"[List "+(t+="NIL")+"]"},t.NIL=new t(null,null),t}();e.SlotList=r},171:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GenericEvent=void 0;var r=function(){function t(t){void 0===t&&(t=!1),this._bubbles=t}return Object.defineProperty(t.prototype,"signal",{get:function(){return this._signal},set:function(t){this._signal=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"target",{get:function(){return this._target},set:function(t){this._target=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentTarget",{get:function(){return this._currentTarget},set:function(t){this._currentTarget=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bubbles",{get:function(){return this._bubbles},set:function(t){this._bubbles=t},enumerable:!1,configurable:!0}),t.prototype.clone=function(){return new t(this._bubbles)},t}();e.GenericEvent=r}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,r),o.exports}var n={};(()=>{var t=n;Object.defineProperty(t,"__esModule",{value:!0}),t.SlotList=t.Slot=t.Signal=t.Promise=t.PrioritySignal=t.OnceSignal=t.MonoSignal=t.ISlot=t.ISignal=t.IPrioritySignal=t.IOnceSignal=t.GenericEvent=t.DeluxeSignal=void 0;var e=r(769);Object.defineProperty(t,"DeluxeSignal",{enumerable:!0,get:function(){return e.DeluxeSignal}});var i=r(171);Object.defineProperty(t,"GenericEvent",{enumerable:!0,get:function(){return i.GenericEvent}});var o=r(43);Object.defineProperty(t,"IOnceSignal",{enumerable:!0,get:function(){return o.IOnceSignal}});var s=r(1);Object.defineProperty(t,"IPrioritySignal",{enumerable:!0,get:function(){return s.IPrioritySignal}});var l=r(579);Object.defineProperty(t,"ISignal",{enumerable:!0,get:function(){return l.ISignal}});var a=r(234);Object.defineProperty(t,"ISlot",{enumerable:!0,get:function(){return a.ISlot}});var u=r(418);Object.defineProperty(t,"MonoSignal",{enumerable:!0,get:function(){return u.MonoSignal}});var c=r(556);Object.defineProperty(t,"OnceSignal",{enumerable:!0,get:function(){return c.OnceSignal}});var h=r(73);Object.defineProperty(t,"PrioritySignal",{enumerable:!0,get:function(){return h.PrioritySignal}});var p=r(69);Object.defineProperty(t,"Promise",{enumerable:!0,get:function(){return p.Promise}});var f=r(561);Object.defineProperty(t,"Signal",{enumerable:!0,get:function(){return f.Signal}});var y=r(952);Object.defineProperty(t,"Slot",{enumerable:!0,get:function(){return y.Slot}});var d=r(602);Object.defineProperty(t,"SlotList",{enumerable:!0,get:function(){return d.SlotList}})})(),SignalsJS=n})();