fix(zone.js): patch nodejs EventEmtter.prototype.off (#37863)
Close #35473 zone.js nodejs patch should also patch `EventEmitter.prototype.off` as `removeListener`. So `off` can correctly remove the listeners added by `EventEmitter.prototype.addListener` PR Close #37863
This commit is contained in:

committed by
Misko Hevery

parent
a71f114ba4
commit
1822cbcd46
@ -16,6 +16,7 @@ Zone.__load_patch('EventEmitter', (global: any) => {
|
||||
const EE_REMOVE_ALL_LISTENER = 'removeAllListeners';
|
||||
const EE_LISTENERS = 'listeners';
|
||||
const EE_ON = 'on';
|
||||
const EE_OFF = 'off';
|
||||
|
||||
const compareTaskCallbackVsDelegate = function(task: any, delegate: any) {
|
||||
// same callback, same capture, same event name, just return
|
||||
@ -47,6 +48,7 @@ Zone.__load_patch('EventEmitter', (global: any) => {
|
||||
});
|
||||
if (result && result[0]) {
|
||||
obj[EE_ON] = obj[EE_ADD_LISTENER];
|
||||
obj[EE_OFF] = obj[EE_REMOVE_LISTENER];
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user