Skip to content

Commit

Permalink
events: variable originalListener is useless
Browse files Browse the repository at this point in the history
PR-URL: #33596
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
fuxingZhang authored and addaleax committed Sep 22, 2020
1 parent 17a098b commit 5c3c8b3
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,6 @@ EventEmitter.prototype.prependOnceListener =
// Emits a 'removeListener' event if and only if the listener was removed.
EventEmitter.prototype.removeListener =
function removeListener(type, listener) {
let originalListener;

checkListener(listener);

const events = this._events;
Expand All @@ -473,7 +471,6 @@ EventEmitter.prototype.removeListener =

for (let i = list.length - 1; i >= 0; i--) {
if (list[i] === listener || list[i].listener === listener) {
originalListener = list[i].listener;
position = i;
break;
}
Expand All @@ -494,7 +491,7 @@ EventEmitter.prototype.removeListener =
events[type] = list[0];

if (events.removeListener !== undefined)
this.emit('removeListener', type, originalListener || listener);
this.emit('removeListener', type, listener);
}

return this;
Expand Down

0 comments on commit 5c3c8b3

Please sign in to comment.