Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
fix removeListener when the listener is attached by EventEmitter.once
Browse files Browse the repository at this point in the history
  • Loading branch information
JiaLiPassion committed Nov 5, 2016
1 parent 12a31e1 commit 2ee4711
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
3 changes: 2 additions & 1 deletion dist/zone-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,8 @@ function findExistingRegisteredTask(target, handler, name, capture, remove) {
for (var i = 0; i < eventTasks.length; i++) {
var eventTask = eventTasks[i];
var data = eventTask.data;
if (data.handler === handler && data.useCapturing === capture && data.eventName === name) {
var listener = data.handler;
if ((data.handler === handler || listener.listener === handler) && data.useCapturing === capture && data.eventName === name) {
if (remove) {
eventTasks.splice(i, 1);
}
Expand Down
3 changes: 2 additions & 1 deletion dist/zone.js
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,8 @@ function findExistingRegisteredTask(target, handler, name, capture, remove) {
for (var i = 0; i < eventTasks.length; i++) {
var eventTask = eventTasks[i];
var data = eventTask.data;
if (data.handler === handler && data.useCapturing === capture && data.eventName === name) {
var listener = data.handler;
if ((data.handler === handler || listener.listener === handler) && data.useCapturing === capture && data.eventName === name) {
if (remove) {
eventTasks.splice(i, 1);
}
Expand Down
Loading

0 comments on commit 2ee4711

Please sign in to comment.