UNPKG

1.91 kBTypeScriptView Raw
1import { OperatorFunction, ObservableInput, ObservedValueOf } from '../types';
2/**
3 * Converts a higher-order Observable into a first-order Observable by dropping
4 * inner Observables while the previous inner Observable has not yet completed.
5 *
6 * <span class="informal">Flattens an Observable-of-Observables by dropping the
7 * next inner Observables while the current inner is still executing.</span>
8 *
9 * ![](exhaustAll.svg)
10 *
11 * `exhaustAll` subscribes to an Observable that emits Observables, also known as a
12 * higher-order Observable. Each time it observes one of these emitted inner
13 * Observables, the output Observable begins emitting the items emitted by that
14 * inner Observable. So far, it behaves like {@link mergeAll}. However,
15 * `exhaustAll` ignores every new inner Observable if the previous Observable has
16 * not yet completed. Once that one completes, it will accept and flatten the
17 * next inner Observable and repeat this process.
18 *
19 * ## Example
20 *
21 * Run a finite timer for each click, only if there is no currently active timer
22 *
23 * ```ts
24 * import { fromEvent, map, interval, take, exhaustAll } from 'rxjs';
25 *
26 * const clicks = fromEvent(document, 'click');
27 * const higherOrder = clicks.pipe(
28 * map(() => interval(1000).pipe(take(5)))
29 * );
30 * const result = higherOrder.pipe(exhaustAll());
31 * result.subscribe(x => console.log(x));
32 * ```
33 *
34 * @see {@link combineLatestAll}
35 * @see {@link concatAll}
36 * @see {@link switchAll}
37 * @see {@link switchMap}
38 * @see {@link mergeAll}
39 * @see {@link exhaustMap}
40 * @see {@link zipAll}
41 *
42 * @return A function that returns an Observable that takes a source of
43 * Observables and propagates the first Observable exclusively until it
44 * completes before subscribing to the next.
45 */
46export declare function exhaustAll<O extends ObservableInput<any>>(): OperatorFunction<O, ObservedValueOf<O>>;
47//# sourceMappingURL=exhaustAll.d.ts.map
\No newline at end of file