@nodeart/event_emitter
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -55,2 +55,4 @@ "use strict"; | ||
EventEmitter.prototype.emit = function (eventName) { | ||
var _this = this; | ||
for (var _len4 = arguments.length, args = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) { | ||
@@ -62,3 +64,3 @@ args[_key4 - 1] = arguments[_key4]; | ||
this.events[eventName] = this.events[eventName].filter(function (elem) { | ||
elem.fn.apply(elem, args); | ||
elem.fn.apply(_this, args); | ||
return !elem.once; | ||
@@ -65,0 +67,0 @@ }); |
@@ -1,1 +0,1 @@ | ||
"use strict";!function t(e,n,r){function o(u,f){if(!n[u]){if(!e[u]){var s="function"==typeof require&&require;if(!f&&s)return s(u,!0);if(i)return i(u,!0);throw new Error("Cannot find module '"+u+"'")}var h=n[u]={exports:{}};e[u][0].call(h.exports,function(t){var n=e[u][1][t];return o(n?n:t)},h,h.exports,t,e,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(t,e,n){function r(){this.events={}}var o=function(t){return function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return this.events[e]=r.reduce(function(e,n){return e.push({fn:n,once:t}),e},this.events[e]||[]),this}},i=o(!1),u=o(!0);r.prototype.on=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return i.apply(this,e)},r.prototype.once=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return u.apply(this,e)},r.prototype.emit=function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return this.events[t]?(this.events[t]=this.events[t].filter(function(t){return t.fn.apply(t,n),!t.once}),this):this},r.prototype.off=function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return this.events[t]?(n.length>0?this.events[t]=this.events[t].filter(function(t){return!n.includes(t.fn)}):delete this.events[t],this):this},r.prototype.offAll=function(){return this.events={},this},void 0!==e&&e.exports&&(e.exports=r),"undefined"!=typeof window&&document&&(window.EventEmitter=r)},{}]},{},[1]); | ||
"use strict";!function t(e,n,r){function i(u,f){if(!n[u]){if(!e[u]){var s="function"==typeof require&&require;if(!f&&s)return s(u,!0);if(o)return o(u,!0);throw new Error("Cannot find module '"+u+"'")}var h=n[u]={exports:{}};e[u][0].call(h.exports,function(t){var n=e[u][1][t];return i(n?n:t)},h,h.exports,t,e,n,r)}return n[u].exports}for(var o="function"==typeof require&&require,u=0;u<r.length;u++)i(r[u]);return i}({1:[function(t,e,n){function r(){this.events={}}var i=function(t){return function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return this.events[e]=r.reduce(function(e,n){return e.push({fn:n,once:t}),e},this.events[e]||[]),this}},o=i(!1),u=i(!0);r.prototype.on=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return o.apply(this,e)},r.prototype.once=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return u.apply(this,e)},r.prototype.emit=function(t){for(var e=this,n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return this.events[t]?(this.events[t]=this.events[t].filter(function(t){return t.fn.apply(e,r),!t.once}),this):this},r.prototype.off=function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return this.events[t]?(n.length>0?this.events[t]=this.events[t].filter(function(t){return!n.includes(t.fn)}):delete this.events[t],this):this},r.prototype.offAll=function(){return this.events={},this},void 0!==e&&e.exports&&(e.exports=r),"undefined"!=typeof window&&document&&(window.EventEmitter=r)},{}]},{},[1]); |
{ | ||
"name": "@nodeart/event_emitter", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Simple EventEmitter pattern", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
@@ -30,3 +30,3 @@ "use strict"; | ||
this.events[eventName] = this.events[eventName].filter(elem => { | ||
elem.fn(...args); | ||
elem.fn.apply(this, args); | ||
return !elem.once; | ||
@@ -33,0 +33,0 @@ }); |
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
9966
140