mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
1 line
1.8 KiB
JavaScript
1 line
1.8 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,n,o){function r(f,u){if(!n[f]){if(!t[f]){var s="function"==typeof require&&require;if(!u&&s)return s(f,!0);if(i)return i(f,!0);var c=new Error("Cannot find module '"+f+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[f]={exports:{}};t[f][0].call(l.exports,function(e){var n=t[f][1][e];return r(n?n:e)},l,l.exports,e,t,n,o)}return n[f].exports}for(var i="function"==typeof require&&require,f=0;f<o.length;f++)r(o[f]);return r}({emitify:[function(e,t,n){"use strict";function o(){return this instanceof o?void(this._all={}):new o}t.exports=o,o.prototype._check=function(e,t){var n=2===arguments.length;if("string"!=typeof e)throw Error("event should be string!");if(n&&"function"!=typeof t)throw Error("callback should be function!")},o.prototype.on=function(e,t){var n=this._all[e];return this._check(e,t),n?n.push(t):this._all[e]=[t],this},o.prototype.addListener=o.prototype.on,o.prototype.once=function(e,t){var n=this;return n._check(e,t),n.on(e,function o(){t.apply(null,arguments),n.off(e,o)}),this},o.prototype.off=function(e,t){var n=this._all[e]||[],o=n.indexOf(t);for(this._check(e,t);~o;)n.splice(o,1),o=n.indexOf(t);return this},o.prototype.removeListener=o.prototype.off,o.prototype.emit=function(e){var t=[].slice.call(arguments,1),n=this._all[e];if(this._check(e),n)n.forEach(function(e){e.apply(null,t)});else if("error"===e)throw t[0];return this},o.prototype.removeAllListeners=function(e){return this._check(e),this._all[e]=[],this}},{}]},{},["emitify"])("emitify")});
|