eventemitter2
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -280,3 +280,4 @@ /*! | ||
if (this._all) { | ||
if (this._all && this._all.length) { | ||
handler = this._all.slice(); | ||
if (al > 3) { | ||
@@ -286,16 +287,17 @@ args = new Array(al); | ||
} | ||
for (i = 0, l = this._all.length; i < l; i++) { | ||
for (i = 0, l = handler.length; i < l; i++) { | ||
this.event = type; | ||
switch (al) { | ||
case 1: | ||
this._all[i].call(this, type); | ||
handler[i].call(this, type); | ||
break; | ||
case 2: | ||
this._all[i].call(this, type, arguments[1]); | ||
handler[i].call(this, type, arguments[1]); | ||
break; | ||
case 3: | ||
this._all[i].call(this, type, arguments[1], arguments[2]); | ||
handler[i].call(this, type, arguments[1], arguments[2]); | ||
break; | ||
default: | ||
this._all[i].apply(this, args); | ||
handler[i].apply(this, args); | ||
} | ||
@@ -332,2 +334,5 @@ } | ||
} else if (handler && handler.length) { | ||
// need to make copy of handlers because list can change in the middle | ||
// of emit call | ||
handler = handler.slice(); | ||
if (al > 3) { | ||
@@ -334,0 +339,0 @@ args = new Array(al - 1); |
{ | ||
"name": "eventemitter2", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A Node.js event emitter implementation with namespaces, wildcards, TTL and browser support.", | ||
@@ -5,0 +5,0 @@ "keywords": ["event", "events", "emitter", "eventemitter"], |
31993
616