Affected Package
The issue is caused by package zone.js
Is this a regression?
Not to my knowledge.
Description
When running in Node, and with patching enabled (the default), Zone does not completely patch EventEmitter.
Zone patches EventEmitter.prototype.on just like it patches EventEmitter.prototoype.addListener because on is an alias for addListener.
However, though off is an alias for removeListener (added in Node 10.0.0), Zone patches EventEmitter.prototoype.removeListener but fails to patch EventEmitter.prototype.off.
🔬 Minimal Reproduction
Clone this repo: https://github.com/lddubeau/zone-bug1-should-patch-off
Then run:
npm install
node index.js
Expected Output
handler got prior to off
Actual Output
handler got prior to off
handler got after off
Discussion
The after off is called to remove the handler, the handler is still there. If the patch variable is set to true to execute the if branch, then we get the expected results.
🌍 Your Environment
Angular Version: I'm just using Zone.js
Zone.js version: 0.10.2
Node.js version: 12.15.0
Affected Package
The issue is caused by package zone.js
Is this a regression?
Not to my knowledge.
Description
When running in Node, and with patching enabled (the default), Zone does not completely patch
EventEmitter.Zone patches
EventEmitter.prototype.onjust like it patchesEventEmitter.prototoype.addListenerbecauseonis an alias foraddListener.However, though
offis an alias forremoveListener(added in Node 10.0.0), Zone patchesEventEmitter.prototoype.removeListenerbut fails to patchEventEmitter.prototype.off.🔬 Minimal Reproduction
Clone this repo: https://github.com/lddubeau/zone-bug1-should-patch-off
Then run:
Expected Output
Actual Output
Discussion
The after
offis called to remove the handler, the handler is still there. If thepatchvariable is set to true to execute theifbranch, then we get the expected results.🌍 Your Environment
Angular Version: I'm just using Zone.js
Zone.js version: 0.10.2
Node.js version: 12.15.0