cloudcmd/modules/emitify/dist/emitify.min.js
2015-12-29 16:18:00 -05:00

1 line
1.6 KiB
JavaScript

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Emitify=e()}}(function(){return function e(t,o,n){function r(f,u){if(!o[f]){if(!t[f]){var c="function"==typeof require&&require;if(!u&&c)return c(f,!0);if(i)return i(f,!0);var s=new Error("Cannot find module '"+f+"'");throw s.code="MODULE_NOT_FOUND",s}var p=o[f]={exports:{}};t[f][0].call(p.exports,function(e){var o=t[f][1][e];return r(o?o:e)},p,p.exports,e,t,o,n)}return o[f].exports}for(var i="function"==typeof require&&require,f=0;f<n.length;f++)r(n[f]);return r}({emitify:[function(e,t,o){"use strict";function n(){return this instanceof n?void(this._all={}):new n}t.exports=n,n.prototype._check=function(e,t){var o=2===arguments.length;if("string"!=typeof e)throw Error("event should be string!");if(o&&"function"!=typeof t)throw Error("callback should be function!")},n.prototype.on=function(e,t){var o=this._all[e];return this._check(e,t),o?o.push(t):this._all[e]=[t],this},n.prototype.addListener=n.prototype.on,n.prototype.once=function(e,t){var o=this;return o._check(e,t),o.on(e,function n(){t(),o.off(e,n)}),this},n.prototype.off=function(e,t){var o=this._all[e]||[],n=o.indexOf(t);for(this._check(e,t);~n;)o.splice(n,1),n=o.indexOf(t);return this},n.prototype.removeListener=n.prototype.off,n.prototype.emit=function(e){var t=[].slice.call(arguments,1),o=this._all[e];if(this._check(e),o)o.forEach(function(e){e.apply(null,t)});else if("error"===e)throw t[0];return this}},{}]},{},["emitify"])("emitify")});