Browse Source

use delete for removing events after removing the final listener

v0.7.4-release
rick 15 years ago
committed by Ryan Dahl
parent
commit
c9e505791a
  1. 4
      lib/events.js

4
lib/events.js

@ -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…
Cancel
Save