Skip to content

Commit

Permalink
pass listener
Browse files Browse the repository at this point in the history
  • Loading branch information
rluvaton committed Jul 28, 2023
1 parent 76befb2 commit f977b2e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/internal/event_target.js
Original file line number Diff line number Diff line change
Expand Up @@ -697,23 +697,23 @@ class EventTarget {
}

// TODO - rename this function
removeInternalListener(type, listener) {
type = webidl.converters.DOMString(type);

removeInternalListener(type, listenerWrapper) {
const root = this[kEvents].get(type);
if (root === undefined || root.next === undefined)
return;

const capture = listener.capture === true;
const capture = listenerWrapper.capture === true;

const listener = listenerWrapper.weak ? listenerWrapper.listener.deref() : listenerWrapper.listener

let handler = root.next;
while (handler !== undefined) {
if (handler === listener) {
if (handler === listenerWrapper) {
handler.remove();
root.size--;
if (root.size === 0)
this[kEvents].delete(type);
this[kRemoveListener](root.size, type, listener.listener, capture);
this[kRemoveListener](root.size, type, listener, capture);
break;
}
handler = handler.next;
Expand Down

0 comments on commit f977b2e

Please sign in to comment.