-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
dual-emitter.min.js
1 lines (1 loc) · 10 KB
/
dual-emitter.min.js
1
!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.DualEmitter=e()}}(function(){return function e(t,n,r){function o(u,s){if(!n[u]){if(!t[u]){var c="function"==typeof require&&require;if(!s&&c)return c(u,!0);if(i)return i(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var a=n[u]={exports:{}};t[u][0].call(a.exports,function(e){var n=t[u][1][e];return o(n?n:e)},a,a.exports,e,t,n,r)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(e,t,n){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],2:[function(e,t,n){function r(){a=!1,s.length?f=s.concat(f):p=-1,f.length&&o()}function o(){if(!a){var e=setTimeout(r);a=!0;for(var t=f.length;t;){for(s=f,f=[];++p<t;)s[p].run();p=-1,t=f.length}s=null,a=!1,clearTimeout(e)}}function i(e,t){this.fun=e,this.array=t}function u(){}var s,c=t.exports={},f=[],a=!1,p=-1;c.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];f.push(new i(e,t)),1!==f.length||a||setTimeout(o,0)},i.prototype.run=function(){this.fun.apply(null,this.array)},c.title="browser",c.browser=!0,c.env={},c.argv=[],c.version="",c.versions={},c.on=u,c.addListener=u,c.once=u,c.off=u,c.removeListener=u,c.removeAllListeners=u,c.emit=u,c.binding=function(e){throw new Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(e){throw new Error("process.chdir is not supported")},c.umask=function(){return 0}},{}],3:[function(e,t,n){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],4:[function(e,t,n){(function(t,r){function o(e,t){var r={seen:[],stylize:u};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),h(t)?r.showHidden=t:t&&n._extend(r,t),O(r.showHidden)&&(r.showHidden=!1),O(r.depth)&&(r.depth=2),O(r.colors)&&(r.colors=!1),O(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=i),c(r,e,r.depth)}function i(e,t){var n=o.styles[t];return n?"["+o.colors[n][0]+"m"+e+"["+o.colors[n][1]+"m":e}function u(e,t){return e}function s(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function c(e,t,r){if(e.customInspect&&t&&D(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var o=t.inspect(r,e);return b(o)||(o=c(e,o,r)),o}var i=f(e,t);if(i)return i;var u=Object.keys(t),h=s(u);if(e.showHidden&&(u=Object.getOwnPropertyNames(t)),j(t)&&(u.indexOf("message")>=0||u.indexOf("description")>=0))return a(t);if(0===u.length){if(D(t)){var d=t.name?": "+t.name:"";return e.stylize("[Function"+d+"]","special")}if(E(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(_(t))return e.stylize(Date.prototype.toString.call(t),"date");if(j(t))return a(t)}var v="",m=!1,w=["{","}"];if(g(t)&&(m=!0,w=["[","]"]),D(t)){var O=t.name?": "+t.name:"";v=" [Function"+O+"]"}if(E(t)&&(v=" "+RegExp.prototype.toString.call(t)),_(t)&&(v=" "+Date.prototype.toUTCString.call(t)),j(t)&&(v=" "+a(t)),0===u.length&&(!m||0==t.length))return w[0]+v+w[1];if(0>r)return E(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var x;return x=m?p(e,t,r,h,u):u.map(function(n){return l(e,t,r,h,n,m)}),e.seen.pop(),y(x,v,w)}function f(e,t){if(O(t))return e.stylize("undefined","undefined");if(b(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return m(t)?e.stylize(""+t,"number"):h(t)?e.stylize(""+t,"boolean"):d(t)?e.stylize("null","null"):void 0}function a(e){return"["+Error.prototype.toString.call(e)+"]"}function p(e,t,n,r,o){for(var i=[],u=0,s=t.length;s>u;++u)N(t,String(u))?i.push(l(e,t,n,r,String(u),!0)):i.push("");return o.forEach(function(o){o.match(/^\d+$/)||i.push(l(e,t,n,r,o,!0))}),i}function l(e,t,n,r,o,i){var u,s,f;if(f=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]},f.get?s=f.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):f.set&&(s=e.stylize("[Setter]","special")),N(r,o)||(u="["+o+"]"),s||(e.seen.indexOf(f.value)<0?(s=d(n)?c(e,f.value,null):c(e,f.value,n-1),s.indexOf("\n")>-1&&(s=i?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n"))):s=e.stylize("[Circular]","special")),O(u)){if(i&&o.match(/^\d+$/))return s;u=JSON.stringify(""+o),u.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(u=u.substr(1,u.length-2),u=e.stylize(u,"name")):(u=u.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),u=e.stylize(u,"string"))}return u+": "+s}function y(e,t,n){var r=0,o=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return o>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function g(e){return Array.isArray(e)}function h(e){return"boolean"==typeof e}function d(e){return null===e}function v(e){return null==e}function m(e){return"number"==typeof e}function b(e){return"string"==typeof e}function w(e){return"symbol"==typeof e}function O(e){return void 0===e}function E(e){return x(e)&&"[object RegExp]"===z(e)}function x(e){return"object"==typeof e&&null!==e}function _(e){return x(e)&&"[object Date]"===z(e)}function j(e){return x(e)&&("[object Error]"===z(e)||e instanceof Error)}function D(e){return"function"==typeof e}function S(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function z(e){return Object.prototype.toString.call(e)}function T(e){return 10>e?"0"+e.toString(10):e.toString(10)}function L(){var e=new Date,t=[T(e.getHours()),T(e.getMinutes()),T(e.getSeconds())].join(":");return[e.getDate(),U[e.getMonth()],t].join(" ")}function N(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var A=/%[sdj%]/g;n.format=function(e){if(!b(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(o(arguments[n]));return t.join(" ")}for(var n=1,r=arguments,i=r.length,u=String(e).replace(A,function(e){if("%%"===e)return"%";if(n>=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return e}}),s=r[n];i>n;s=r[++n])u+=d(s)||!x(s)?" "+s:" "+o(s);return u},n.deprecate=function(e,o){function i(){if(!u){if(t.throwDeprecation)throw new Error(o);t.traceDeprecation?console.trace(o):console.error(o),u=!0}return e.apply(this,arguments)}if(O(r.process))return function(){return n.deprecate(e,o).apply(this,arguments)};if(t.noDeprecation===!0)return e;var u=!1;return i};var H,M={};n.debuglog=function(e){if(O(H)&&(H=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!M[e])if(new RegExp("\\b"+e+"\\b","i").test(H)){var r=t.pid;M[e]=function(){var t=n.format.apply(n,arguments);console.error("%s %d: %s",e,r,t)}}else M[e]=function(){};return M[e]},n.inspect=o,o.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},o.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=g,n.isBoolean=h,n.isNull=d,n.isNullOrUndefined=v,n.isNumber=m,n.isString=b,n.isSymbol=w,n.isUndefined=O,n.isRegExp=E,n.isObject=x,n.isDate=_,n.isError=j,n.isFunction=D,n.isPrimitive=S,n.isBuffer=e("./support/isBuffer");var U=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];n.log=function(){console.log("%s - %s",L(),n.format.apply(n,arguments))},n.inherits=e("inherits"),n._extend=function(e,t){if(!t||!x(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":3,_process:2,inherits:1}],5:[function(e,t,n){"use strict";function r(e){return this instanceof r?void(this._events=e&&"object"==typeof e?e:{}):new r(e)}var o=e("util");t.exports=r,r.prototype.on=function(e,t,n){if("string"!=typeof e)throw new TypeError("DualEmitter#on expect `name` be string");if("function"!=typeof t)throw new TypeError("DualEmitter#on expect `fn` be function");return this._events[e]=this._hasOwn(this._events,e)?this._events[e]:[],this._events[e].push(t),n&&this._isDom(n)&&(t.outerHTML=n.outerHTML,this._element=n,n.addEventListener?n.addEventListener(e,t,!1):n.attachEvent("on"+e,t)),this},r.prototype.off=function(e,t,n){if("string"!=typeof e)throw new TypeError("DualEmitter#off expect `name` be string");if("function"!=typeof t)throw new TypeError("DualEmitter#off expect `fn` be function");return this._hasOwn(this._events,e)?(this._events[e].splice(this._events[e].indexOf(t),1),n&&this._isDom(n)&&(n.removeEventListener?n.removeEventListener(e,t,!1):n.detachEvent("on"+e,t)),this):this},r.prototype.once=function(e,t,n){function r(){return o.off(e,r,n),t.apply(n,arguments)}var o=this;return this.on(e,r,n)},r.prototype.emit=function(e){if(!this._hasOwn(this._events,e))return this;var t=Array.prototype.slice.call(arguments,1),n=t[t.length-1],r=this._isDom(n);n=r?n:this,t=r?t.slice(0,-1):t;for(var o=0;o<this._events[e].length;o++){var i=this._events[e][o];r&&i.outerHTML!==n.outerHTML||i.apply(n,t)}return this},r.prototype._isDom=function(e){return e=Object.prototype.toString.call(e).slice(8,-1),/(?:HTML)?(?:.*)Element/.test(e)},r.prototype._hasOwn=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.extend=function(e,t){o.inherits(e,r);for(var n in r)e[n]=r[n];if("object"==typeof t){var i=Object.create(t);for(var u in i)e.prototype[u]=i[u]}}},{util:4}]},{},[5])(5)});