forked from a64f7bb4-7358-4778-9fbe-3b882c34cc1d/v1
2 lines
982 B
JavaScript
2 lines
982 B
JavaScript
!function(){"use strict";var n="undefined"!=typeof Symbol&&Symbol,i="function"==typeof n&&"symbol"==typeof n.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof n&&t.constructor===n?"symbol":typeof t},e=t.prototype;function t(t){return t?function(t){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}(t):this}e.constructor=t,e._events={},e.on=function(t,n){var e=this;return"object"!==i(e._events[t])&&(e._events[t]=[]),e._events[t].push(n),function(){e.off(t,n)}},e.off=function(t,n){var e,o=this;return"object"===i(o._events[t])&&-1<(e=o._events[t].indexOf(n))&&o._events[t].splice(e,1),o},e.emit=function(t){var n,e,o,r=this,f=[].slice.call(arguments,1);if("object"===i(r._events[t]))for(o=(e=r._events[t].slice()).length,n=0;n<o;n++)e[n].apply(r,f);return r},e.once=function(n,e){var o=this;return o.on(n,function t(){o.off(n,t),e.apply(o,arguments)}),o},"undefined"!=typeof exports?module.exports=t:window.Eventify=t}();
|