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
@ -66,6 +66,18 @@ describe('nodejs EventEmitter', () => {
|
||||
emitter.emit('test2', 'test value');
|
||||
});
|
||||
});
|
||||
it('should remove listeners by calling off properly', () => {
|
||||
zoneA.run(() => {
|
||||
emitter.on('test', shouldNotRun);
|
||||
emitter.on('test2', shouldNotRun);
|
||||
emitter.off('test', shouldNotRun);
|
||||
});
|
||||
zoneB.run(() => {
|
||||
emitter.off('test2', shouldNotRun);
|
||||
emitter.emit('test', 'test value');
|
||||
emitter.emit('test2', 'test value');
|
||||
});
|
||||
});
|
||||
it('remove listener should return event emitter', () => {
|
||||
zoneA.run(() => {
|
||||
emitter.on('test', shouldNotRun);
|
||||
|
Reference in New Issue
Block a user