mirror of https://github.com/nodejs/node.git
use delete for removing events after removing the final listener
parent
abd3f8a02a
commit
c9e505791a
|
@ -91,8 +91,10 @@ process.EventEmitter.prototype.removeListener = function (type, listener) {
|
|||
var i = list.indexOf(listener);
|
||||
if (i < 0) return this;
|
||||
list.splice(i, 1);
|
||||
if (list.length == 0)
|
||||
delete this._events[type];
|
||||
} else if (this._events[type] === listener) {
|
||||
this._events[type] = null;
|
||||
delete this._events[type];
|
||||
}
|
||||
|
||||
return this;
|
||||
|
|
Loading…
Reference in New Issue