exhaust
operator convert higher-order Observable to first-order Observable and will ignore inner observable while previous inner Observable has not yet completed
higher-order Observable: that observable emits Observables
first-order Observable: that observable emits values, and maintains only 1 stream of observable
in this example you can see how to ignores the inner observable when previous inner Observable has not yet completed.
import { fromEvent, timer, interval } from 'rxjs';
import { exhaust, map, take } from 'rxjs/operators';
const projection$ = interval(500).pipe(take(6));
const source$ = timer(0, 2000).pipe(
map(() => projection$),
take(4)
);
const result$ = source$.pipe(exhaust());
Official Doc: rxjs.exhaust