simple-event-emitter
Version:
Simple Event Emitter
1 lines • 2.34 kB
JavaScript
!function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){t.exports=n(1)},function(t,e,n){n(2),n(3),n(4),t.exports=function(){"use strict";function t(t,e){t.Element.addEventListener(t.Name,e,!1)}function e(t){return new CustomEvent(t)}function n(t){return i.find(function(e){return e.Name===t})}function r(t){return i.findIndex(function(e){return e.Name===t})}var o={},i=[];return o.AddListener=function(r,o,c){var u=c?c:document.body,a={Event:e(r),Name:r,Element:u},f=n(r);return f||(i.push(a),t(a,o)),this},o.FireEvent=function(t){try{var e=n(t);return e?(e.Element.dispatchEvent(e.Event),this):this}catch(r){return{success:!1,message:"Error occured while attempting to fire event.",error:r}}},o.RemoveListener=function(t){var e=r(t);return i.splice(e,1),this},window.SEE=o,o}()},function(t,e){!function(t){if(!Array.prototype.find){var e=function(t){var e=Object(this),n=e.length<0?0:e.length>>>0;if(0!==n){if("function"!=typeof t||"[object Function]"!==Object.prototype.toString.call(t))throw new TypeError("Array#find: predicate must be a function");for(var r=arguments[1],o=0,i;n>o;o++)if(i=e[o],t.call(r,i,o,e))return i}};if(Object.defineProperty)try{Object.defineProperty(Array.prototype,"find",{value:e,configurable:!0,enumerable:!1,writable:!0})}catch(n){}Array.prototype.find||(Array.prototype.find=e)}}(this)},function(t,e){!function(t){if(!Array.prototype.findIndex){var e=function(t){var e=Object(this),n=Math.max(0,e.length)>>>0;if(0===n)return-1;if("function"!=typeof t||"[object Function]"!==Object.prototype.toString.call(t))throw new TypeError("Array#findIndex: predicate must be a function");for(var r=arguments.length>1?arguments[1]:void 0,o=0;n>o;o++)if(t.call(r,e[o],o,e))return o;return-1};if(Object.defineProperty)try{Object.defineProperty(Array.prototype,"findIndex",{value:e,configurable:!0,writable:!0})}catch(n){}Array.prototype.findIndex||(Array.prototype.findIndex=e)}}(this)},function(t,e){try{new r("test")}catch(n){var r=function(t,e){var n;return e=e||{bubbles:!1,cancelable:!1,detail:void 0},n=document.createEvent("CustomEvent"),n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n};r.prototype=window.Event.prototype,window.CustomEvent=r}}]);