mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 13:09:42 +00:00
events: use null assignment instead of deleting property
This commit is contained in:
parent
3c293ba272
commit
0397223ab4
@ -226,7 +226,7 @@ EventEmitter.prototype.removeListener = function(type, listener) {
|
|||||||
if (position < 0) return this;
|
if (position < 0) return this;
|
||||||
list.splice(position, 1);
|
list.splice(position, 1);
|
||||||
if (list.length == 0)
|
if (list.length == 0)
|
||||||
delete this._events[type];
|
this._events[type] = null;
|
||||||
|
|
||||||
if (this._events.removeListener) {
|
if (this._events.removeListener) {
|
||||||
this.emit('removeListener', type, listener);
|
this.emit('removeListener', type, listener);
|
||||||
@ -234,7 +234,7 @@ EventEmitter.prototype.removeListener = function(type, listener) {
|
|||||||
} else if (list === listener ||
|
} else if (list === listener ||
|
||||||
(list.listener && list.listener === listener))
|
(list.listener && list.listener === listener))
|
||||||
{
|
{
|
||||||
delete this._events[type];
|
this._events[type] = null;
|
||||||
|
|
||||||
if (this._events.removeListener) {
|
if (this._events.removeListener) {
|
||||||
this.emit('removeListener', type, listener);
|
this.emit('removeListener', type, listener);
|
||||||
|
Loading…
Reference in New Issue
Block a user