futoin-asyncevent
Advanced tools
Comparing version 1.1.0 to 1.1.1
=== 1.1.1 (2018-06-06) === | ||
FIXED: crash Babel instanceof check issue | ||
=== 1.1.0 (2018-06-03) === | ||
@@ -3,0 +6,0 @@ NEW: allow registration of additional events |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["futoin-asyncevent"]=t():e.$asyncevent=t()}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var i="undefined"!=typeof setImmediate&&setImmediate||function(e){return setTimeout(e,0)},a=Symbol("FutoIn Event Emitter"),u="_evt_",f="_evtonce_",l=function(){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this._max=n;var r=!0,o=!1,i=void 0;try{for(var a,l=e[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){var c=a.value;this[""+u+c]=[],this[""+f+c]=[]}}catch(e){o=!0,i=e}finally{try{!r&&l.return&&l.return()}finally{if(o)throw i}}}return r(t,[{key:"on",value:function(e,t){try{var n=this[""+u+e];n.length===this._max&&console.warn("Hitting max handler limit for: "+e),n.push(t)}catch(t){throw new Error("Unknown event: "+e)}}},{key:"once",value:function(e,t){try{var n=this[""+f+e];n.length===this._max&&console.warn("Hitting max once handler limit for: "+e),n.push(t)}catch(t){throw new Error("Unknown event: "+e)}}},{key:"off",value:function(e,t){try{var n=""+u+e;this[n]=this[n].filter(function(e){return e!==t});var r=""+f+e;this[r]=this[r].filter(function(e){return e!==t})}catch(t){throw new Error("Unknown event: "+e)}}},{key:"emit",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];try{var o=function(e){i(function(){return e.apply(void 0,n)})},a=!0,l=!1,c=void 0;try{for(var v,y=this[""+u+e][Symbol.iterator]();!(a=(v=y.next()).done);a=!0)o(v.value)}catch(e){l=!0,c=e}finally{try{!a&&y.return&&y.return()}finally{if(l)throw c}}var s=this[""+f+e];if(s.length>0){var d=function(e){i(function(){return e.apply(void 0,n)})},h=!0,b=!1,m=void 0;try{for(var p,w=s[Symbol.iterator]();!(h=(p=w.next()).done);h=!0)d(p.value)}catch(e){b=!0,m=e}finally{try{!h&&w.return&&w.return()}finally{if(b)throw m}}this[""+f+e]=[]}}catch(t){throw new Error("Unknown event: "+e)}}}],[{key:Symbol.hasInstance,value:function(e){return void 0!==e[a]}},{key:"attach",value:function(t,n){var r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,l=t[a];if(void 0===l){var c=new e.exports(n,i);Object.defineProperties(t,(o(r={},a,{configurable:!1,enumerable:!1,writable:!1,value:c}),o(r,"on",{configurable:!1,enumerable:!1,writable:!1,value:function(e,t){return c.on(e,t)}}),o(r,"off",{configurable:!1,enumerable:!1,writable:!1,value:function(e,t){return c.off(e,t)}}),o(r,"once",{configurable:!1,enumerable:!1,writable:!1,value:function(e,t){return c.once(e,t)}}),o(r,"emit",{configurable:!1,enumerable:!1,writable:!1,value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return c.emit.apply(c,[e].concat(n))}}),r))}else{l._max=i;var v=!0,y=!1,s=void 0;try{for(var d,h=n[Symbol.iterator]();!(v=(d=h.next()).done);v=!0){var b=d.value;if(""+u+b in l)throw new Error('Event "'+b+'" has been already registered!');l[""+u+b]=[],l[""+f+b]=[]}}catch(e){y=!0,s=e}finally{try{!v&&h.return&&h.return()}finally{if(y)throw s}}}}},{key:"setMaxListeners",value:function(e,t){e[a]._max=t}},{key:"SYM_EVENT_EMITTER",get:function(){return a}}]),t}();e.exports=l},function(e,t,n){"use strict";var r=n(0),o=r.attach;o.EventEmitter=r,e.exports=o},function(e,t,n){"use strict";!function(t){var r=t.FutoIn||t.futoin||{};if(void 0===r.$asyncevent){var o=n(1);t.$asyncevent=o,r.$asyncevent=o,r.EventEmitter=o.EventEmitter,t.FutoIn=r,t.futoin=r}e.exports=r.$asyncevent}(window)}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["futoin-asyncevent"]=t():e.$asyncevent=t()}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var i="undefined"!=typeof setImmediate&&setImmediate||function(e){return setTimeout(e,0)},a=Symbol("FutoIn Event Emitter"),u="_evt_",f="_evtonce_",l=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._max=n;var r=!0,o=!1,i=void 0;try{for(var a,l=t[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){var c=a.value;this[""+u+c]=[],this[""+f+c]=[]}}catch(e){o=!0,i=e}finally{try{!r&&l.return&&l.return()}finally{if(o)throw i}}}return r(e,[{key:"on",value:function(e,t){try{var n=this[""+u+e];n.length===this._max&&console.warn("Hitting max handler limit for: "+e),n.push(t)}catch(t){throw new Error("Unknown event: "+e)}}},{key:"once",value:function(e,t){try{var n=this[""+f+e];n.length===this._max&&console.warn("Hitting max once handler limit for: "+e),n.push(t)}catch(t){throw new Error("Unknown event: "+e)}}},{key:"off",value:function(e,t){try{var n=""+u+e;this[n]=this[n].filter(function(e){return e!==t});var r=""+f+e;this[r]=this[r].filter(function(e){return e!==t})}catch(t){throw new Error("Unknown event: "+e)}}},{key:"emit",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];try{var o=function(e){i(function(){return e.apply(void 0,n)})},a=!0,l=!1,c=void 0;try{for(var v,y=this[""+u+e][Symbol.iterator]();!(a=(v=y.next()).done);a=!0){o(v.value)}}catch(e){l=!0,c=e}finally{try{!a&&y.return&&y.return()}finally{if(l)throw c}}var s=this[""+f+e];if(s.length>0){var d=function(e){i(function(){return e.apply(void 0,n)})},h=!0,b=!1,m=void 0;try{for(var p,w=s[Symbol.iterator]();!(h=(p=w.next()).done);h=!0){d(p.value)}}catch(e){b=!0,m=e}finally{try{!h&&w.return&&w.return()}finally{if(b)throw m}}this[""+f+e]=[]}}catch(t){throw new Error("Unknown event: "+e)}}}],[{key:Symbol.hasInstance,value:function(t){return void 0!==t[a]||t.constructor===e}},{key:"attach",value:function(t,n){var r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,l=t[a];if(void 0===l){var c=new e(n,i);Object.defineProperties(t,(o(r={},a,{configurable:!1,enumerable:!1,writable:!1,value:c}),o(r,"on",{configurable:!1,enumerable:!1,writable:!1,value:function(e,t){return c.on(e,t)}}),o(r,"off",{configurable:!1,enumerable:!1,writable:!1,value:function(e,t){return c.off(e,t)}}),o(r,"once",{configurable:!1,enumerable:!1,writable:!1,value:function(e,t){return c.once(e,t)}}),o(r,"emit",{configurable:!1,enumerable:!1,writable:!1,value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return c.emit.apply(c,[e].concat(n))}}),r))}else{l._max=i;var v=!0,y=!1,s=void 0;try{for(var d,h=n[Symbol.iterator]();!(v=(d=h.next()).done);v=!0){var b=d.value;if(""+u+b in l)throw new Error('Event "'+b+'" has been already registered!');l[""+u+b]=[],l[""+f+b]=[]}}catch(e){y=!0,s=e}finally{try{!v&&h.return&&h.return()}finally{if(y)throw s}}}}},{key:"setMaxListeners",value:function(e,t){e[a]._max=t}},{key:"SYM_EVENT_EMITTER",get:function(){return a}}]),e}();e.exports=l},function(e,t,n){"use strict";var r=n(0),o=r.attach;o.EventEmitter=r,e.exports=o},function(e,t,n){"use strict";!function(t){var r=t.FutoIn||t.futoin||{};if(void 0===r.$asyncevent){var o=n(1);t.$asyncevent=o,r.$asyncevent=o,r.EventEmitter=o.EventEmitter,t.FutoIn=r,t.futoin=r}e.exports=r.$asyncevent}(window)}])}); |
@@ -237,3 +237,3 @@ 'use strict'; | ||
value: function value(instance) { | ||
return instance[SYM_EVENT_EMITTER] !== undefined; | ||
return instance[SYM_EVENT_EMITTER] !== undefined || instance.constructor === EventEmitter; | ||
} | ||
@@ -293,3 +293,3 @@ | ||
var ee = new module.exports(allowed_events, max_listeners); | ||
var ee = new EventEmitter(allowed_events, max_listeners); | ||
@@ -296,0 +296,0 @@ Object.defineProperties(instance, (_Object$definePropert = {}, _defineProperty(_Object$definePropert, SYM_EVENT_EMITTER, { |
@@ -316,2 +316,5 @@ 'use strict'; | ||
expect(o instanceof $asyncevent.EventEmitter).to.be.true; | ||
var ee = new $asyncevent.EventEmitter(['evt'], 1); | ||
expect(ee instanceof $asyncevent.EventEmitter).to.be.true; | ||
}); | ||
@@ -318,0 +321,0 @@ } |
@@ -135,3 +135,6 @@ 'use strict'; | ||
static [Symbol.hasInstance]( instance ) { | ||
return instance[SYM_EVENT_EMITTER] !== undefined; | ||
return ( | ||
( instance[SYM_EVENT_EMITTER] !== undefined ) || | ||
( instance.constructor === EventEmitter ) | ||
); | ||
} | ||
@@ -163,3 +166,3 @@ | ||
const ee = new module.exports( allowed_events, max_listeners ); | ||
const ee = new EventEmitter( allowed_events, max_listeners ); | ||
@@ -166,0 +169,0 @@ Object.defineProperties( |
{ | ||
"name": "futoin-asyncevent", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "FutoIn AsyncEvent - FTN15 compliant event emitter", | ||
@@ -5,0 +5,0 @@ "main": "lib/asyncevent.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
126724
980