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 codebytere committed Jun 18, 2020
1 parent b280c86 commit 27c90ef
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 @@ -449,8 +449,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 @@ -474,7 +472,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 @@ -495,7 +492,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 27c90ef

Please sign in to comment.