forkJoin
emits only when all inner observables have completed.
If you need an equivalent of forkJoin
that just listens to a single emission from each source, use combineLatest
+ take(1)
combineLatest(
this.statuses$,
this.companies$,
)
.pipe(
take(1),
)
.subscribe(([statuses, companies]) => {
console.log('forkjoin');
this._countStatus(statuses, companies);
});
As soon as both sources emit, combineLatest
will emit and take(1)
will unsubscribe immediately after that.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…