fix(core): fix proper propagation of subscriptions in EventEmitter (#22016)
Closes #21999 PR Close #22016
This commit is contained in:

committed by
Alex Rickabaugh

parent
f0396f1e54
commit
c6645e7a04
@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
import {Subject} from 'rxjs/Subject';
|
||||
import {Subscription} from 'rxjs/Subscription';
|
||||
|
||||
/**
|
||||
* Use by directives and components to emit custom Events.
|
||||
@ -111,6 +112,12 @@ export class EventEmitter<T> extends Subject<T> {
|
||||
}
|
||||
}
|
||||
|
||||
return super.subscribe(schedulerFn, errorFn, completeFn);
|
||||
const sink = super.subscribe(schedulerFn, errorFn, completeFn);
|
||||
|
||||
if (generatorOrNext instanceof Subscription) {
|
||||
generatorOrNext.add(sink);
|
||||
}
|
||||
|
||||
return sink;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user