fix(core): fix proper propagation of subscriptions in EventEmitter (#22016)

Closes #21999

PR Close #22016
This commit is contained in:
Martin Sikora
2018-02-04 17:58:02 +01:00
committed by Alex Rickabaugh
parent f0396f1e54
commit c6645e7a04
2 changed files with 63 additions and 1 deletions

View File

@ -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;
}
}