concatAll.d.ts 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import { MonoTypeOperatorFunction } from '../interfaces';
  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. * <img src="./img/concatAll.png" width="100%">
  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 <caption>For each click event, tick every second from 0 to 3, with no concurrency</caption>
  25. * var clicks = Rx.Observable.fromEvent(document, 'click');
  26. * var higherOrder = clicks.map(ev => Rx.Observable.interval(1000).take(4));
  27. * var firstOrder = higherOrder.concatAll();
  28. * firstOrder.subscribe(x => console.log(x));
  29. *
  30. * // Results in the following:
  31. * // (results are not concurrent)
  32. * // For every click on the "document" it will emit values 0 to 3 spaced
  33. * // on a 1000ms interval
  34. * // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3
  35. *
  36. * @see {@link combineAll}
  37. * @see {@link concat}
  38. * @see {@link concatMap}
  39. * @see {@link concatMapTo}
  40. * @see {@link exhaust}
  41. * @see {@link mergeAll}
  42. * @see {@link switch}
  43. * @see {@link zipAll}
  44. *
  45. * @return {Observable} An Observable emitting values from all the inner
  46. * Observables concatenated.
  47. * @method concatAll
  48. * @owner Observable
  49. */
  50. export declare function concatAll<T>(): MonoTypeOperatorFunction<T>;