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

Commit

Permalink
fix(utils): fixes event target patch in web workers
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Hill authored and vicb committed Sep 25, 2015
1 parent 1d4370b commit ad5c0c8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ function patchEventTargetMethods(obj) {
arguments[1] = handler[boundFnsKey][eventType];
}

return global.zone.addEventListener.apply(this, arguments);
var target = isWebWorker() && !this ? self : this;

return global.zone.addEventListener.apply(target, arguments);
};

// This is required for the removeEventListener hook on the root zone.
Expand All @@ -131,7 +133,8 @@ function patchEventTargetMethods(obj) {
arguments[1] = _bound[eventType];
delete _bound[eventType];
}
var result = global.zone.removeEventListener.apply(this, arguments);
var target = isWebWorker() && !this ? self : this;
var result = global.zone.removeEventListener.apply(target, arguments);
global.zone.dequeueTask(handler[originalFnKey]);
return result;
};
Expand Down

0 comments on commit ad5c0c8

Please sign in to comment.