source: trip-planner-front/node_modules/rxjs/src/internal/operators/concatAll.ts@ 571e0df

Last change on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.3 KB
Line 
1
2import { mergeAll } from './mergeAll';
3import { OperatorFunction, ObservableInput } from '../types';
4
5export function concatAll<T>(): OperatorFunction<ObservableInput<T>, T>;
6export function concatAll<R>(): OperatorFunction<any, R>;
7
8/**
9 * Converts a higher-order Observable into a first-order Observable by
10 * concatenating the inner Observables in order.
11 *
12 * <span class="informal">Flattens an Observable-of-Observables by putting one
13 * inner Observable after the other.</span>
14 *
15 * ![](concatAll.png)
16 *
17 * Joins every Observable emitted by the source (a higher-order Observable), in
18 * a serial fashion. It subscribes to each inner Observable only after the
19 * previous inner Observable has completed, and merges all of their values into
20 * the returned observable.
21 *
22 * __Warning:__ If the source Observable emits Observables quickly and
23 * endlessly, and the inner Observables it emits generally complete slower than
24 * the source emits, you can run into memory issues as the incoming Observables
25 * collect in an unbounded buffer.
26 *
27 * Note: `concatAll` is equivalent to `mergeAll` with concurrency parameter set
28 * to `1`.
29 *
30 * ## Example
31 *
32 * For each click event, tick every second from 0 to 3, with no concurrency
33 * ```ts
34 * import { fromEvent, interval } from 'rxjs';
35 * import { map, take, concatAll } from 'rxjs/operators';
36 *
37 * const clicks = fromEvent(document, 'click');
38 * const higherOrder = clicks.pipe(
39 * map(ev => interval(1000).pipe(take(4))),
40 * );
41 * const firstOrder = higherOrder.pipe(concatAll());
42 * firstOrder.subscribe(x => console.log(x));
43 *
44 * // Results in the following:
45 * // (results are not concurrent)
46 * // For every click on the "document" it will emit values 0 to 3 spaced
47 * // on a 1000ms interval
48 * // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3
49 * ```
50 *
51 * @see {@link combineAll}
52 * @see {@link concat}
53 * @see {@link concatMap}
54 * @see {@link concatMapTo}
55 * @see {@link exhaust}
56 * @see {@link mergeAll}
57 * @see {@link switchAll}
58 * @see {@link switchMap}
59 * @see {@link zipAll}
60 *
61 * @return {Observable} An Observable emitting values from all the inner
62 * Observables concatenated.
63 * @method concatAll
64 * @owner Observable
65 */
66export function concatAll<T>(): OperatorFunction<ObservableInput<T>, T> {
67 return mergeAll<T>(1);
68}
Note: See TracBrowser for help on using the repository browser.