UNPKG

2.18 kBTypeScriptView Raw
1import { OperatorFunction, ObservableInput, ObservedValueOf } from '../types';
2/**
3 * Converts a higher-order Observable into a first-order Observable by
4 * concatenating the inner Observables in order.
5 *
6 * <span class="informal">Flattens an Observable-of-Observables by putting one
7 * inner Observable after the other.</span>
8 *
9 * ![](concatAll.svg)
10 *
11 * Joins every Observable emitted by the source (a higher-order Observable), in
12 * a serial fashion. It subscribes to each inner Observable only after the
13 * previous inner Observable has completed, and merges all of their values into
14 * the returned observable.
15 *
16 * __Warning:__ If the source Observable emits Observables quickly and
17 * endlessly, and the inner Observables it emits generally complete slower than
18 * the source emits, you can run into memory issues as the incoming Observables
19 * collect in an unbounded buffer.
20 *
21 * Note: `concatAll` is equivalent to `mergeAll` with concurrency parameter set
22 * to `1`.
23 *
24 * ## Example
25 *
26 * For each click event, tick every second from 0 to 3, with no concurrency
27 * ```ts
28 * import { fromEvent, interval } from 'rxjs';
29 * import { map, take, concatAll } from 'rxjs/operators';
30 *
31 * const clicks = fromEvent(document, 'click');
32 * const higherOrder = clicks.pipe(
33 * map(ev => interval(1000).pipe(take(4))),
34 * );
35 * const firstOrder = higherOrder.pipe(concatAll());
36 * firstOrder.subscribe(x => console.log(x));
37 *
38 * // Results in the following:
39 * // (results are not concurrent)
40 * // For every click on the "document" it will emit values 0 to 3 spaced
41 * // on a 1000ms interval
42 * // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3
43 * ```
44 *
45 * @see {@link combineLatestAll}
46 * @see {@link concat}
47 * @see {@link concatMap}
48 * @see {@link concatMapTo}
49 * @see {@link exhaustAll}
50 * @see {@link mergeAll}
51 * @see {@link switchAll}
52 * @see {@link switchMap}
53 * @see {@link zipAll}
54 *
55 * @return A function that returns an Observable emitting values from all the
56 * inner Observables concatenated.
57 */
58export declare function concatAll<O extends ObservableInput<any>>(): OperatorFunction<O, ObservedValueOf<O>>;
59//# sourceMappingURL=concatAll.d.ts.map
\No newline at end of file