8 lines
3.3 KiB
JavaScript
8 lines
3.3 KiB
JavaScript
/**
|
|
* Minified by jsDelivr using UglifyJS v3.4.4.
|
|
* Original file: /npm/uevent@2.0.0/browser.js
|
|
*
|
|
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
|
|
*/
|
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).uEvent={})}(this,function(e){"use strict";var n=function(){return!0},i=function(){return!1},c=function(){function e(e,t,n){Object.defineProperties(this,{target:{get:function(){return e},set:function(e){},enumerable:!0},type:{get:function(){return t},set:function(e){},enumerable:!0},args:{get:function(){return n},set:function(e){},enumerable:!0}}),this.isDefaultPrevented=i,this.isPropagationStopped=i}var t=e.prototype;return t.preventDefault=function(){this.isDefaultPrevented=n},t.stopPropagation=function(){this.isPropagationStopped=n},e}(),s=function(){function e(){}var t=e.prototype;return t.on=function(e,t){if(this.__events=this.__events||{},"object"==typeof e)for(var n in e)e.hasOwnProperty(n)&&(this.__events[n]=this.__events[n]||[],this.__events[n].push(e[n]));else e.split(" ").forEach(function(e){this.__events[e]=this.__events[e]||[],this.__events[e].push(t)},this);return this},t.off=function(e,n){if(this.__events=this.__events||{},"object"==typeof e){for(var t in e)if(e.hasOwnProperty(t)&&t in this.__events){var i=this.__events[t].indexOf(e[t]);-1!==i&&this.__events[t].splice(i,1)}}else e?e.split(" ").forEach(function(e){if(e in this.__events)if(n){var t=this.__events[e].indexOf(n);-1!==t&&this.__events[e].splice(t,1)}else this.__events[e].length=0},this):this.__events={};return this},t.once=function(e,t){if(this.__once=this.__once||{},"object"==typeof e)for(var n in e)e.hasOwnProperty(n)&&(this.__once[n]=this.__once[n]||[],this.__once[n].push(e[n]));else e.split(" ").forEach(function(e){this.__once[e]=this.__once[e]||[],this.__once[e].push(t)},this);return this},t.trigger=function(e){var t=Array.prototype.slice.call(arguments,1),n=new c(this,e,t);if(this.__events&&e in this.__events)for(var i=0,s=this.__events[e].length;i<s;i++){var o=this.__events[e][i];if("object"==typeof o?o.handleEvent(n):o.call.apply(o,[this,n].concat(t)),n.isPropagationStopped())return n}if(this.__once&&e in this.__once){for(var r=0,_=this.__once[e].length;r<_;r++){var f=this.__once[e][r];if("object"==typeof f?f.handleEvent(n):f.call.apply(f,[this,n].concat(t)),n.isPropagationStopped())return delete this.__once[e],n}delete this.__once[e]}return n},t.change=function(e,t){var n=Array.prototype.slice.call(arguments,2),i=new c(this,e,n);if(i.value=t,this.__events&&e in this.__events)for(var s=0,o=this.__events[e].length;s<o;s++){var r=this.__events[e][s];if(i.value="object"==typeof r?r.handleEvent(i):r.call.apply(r,[this,i,i.value].concat(n)),i.isPropagationStopped())return i.value}return i.value},e}();var t={EventEmitter:s,mixin:function(t){t="function"==typeof t?t.prototype:t,["on","off","once","trigger","change"].forEach(function(e){t[e]=s.prototype[e]}),Object.defineProperties(t,{__events:{value:null,writable:!0},__once:{value:null,writable:!0}})}},o=t.EventEmitter,r=t.mixin;e.default=t,e.EventEmitter=o,e.mixin=r,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
//# sourceMappingURL=/sm/18fda092d74d60efcb0ef0f4c40d2290935c281c1316cefb929dee06e3bc6c32.map
|