1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. "use strict";
  2. var concatAll_1 = require('../operators/concatAll');
  3. /* tslint:enable:max-line-length */
  4. /**
  5. * Converts a higher-order Observable into a first-order Observable by
  6. * concatenating the inner Observables in order.
  7. *
  8. * <span class="informal">Flattens an Observable-of-Observables by putting one
  9. * inner Observable after the other.</span>
  10. *
  11. * <img src="./img/concatAll.png" width="100%">
  12. *
  13. * Joins every Observable emitted by the source (a higher-order Observable), in
  14. * a serial fashion. It subscribes to each inner Observable only after the
  15. * previous inner Observable has completed, and merges all of their values into
  16. * the returned observable.
  17. *
  18. * __Warning:__ If the source Observable emits Observables quickly and
  19. * endlessly, and the inner Observables it emits generally complete slower than
  20. * the source emits, you can run into memory issues as the incoming Observables
  21. * collect in an unbounded buffer.
  22. *
  23. * Note: `concatAll` is equivalent to `mergeAll` with concurrency parameter set
  24. * to `1`.
  25. *
  26. * @example <caption>For each click event, tick every second from 0 to 3, with no concurrency</caption>
  27. * var clicks = Rx.Observable.fromEvent(document, 'click');
  28. * var higherOrder = clicks.map(ev => Rx.Observable.interval(1000).take(4));
  29. * var firstOrder = higherOrder.concatAll();
  30. * firstOrder.subscribe(x => console.log(x));
  31. *
  32. * // Results in the following:
  33. * // (results are not concurrent)
  34. * // For every click on the "document" it will emit values 0 to 3 spaced
  35. * // on a 1000ms interval
  36. * // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3
  37. *
  38. * @see {@link combineAll}
  39. * @see {@link concat}
  40. * @see {@link concatMap}
  41. * @see {@link concatMapTo}
  42. * @see {@link exhaust}
  43. * @see {@link mergeAll}
  44. * @see {@link switch}
  45. * @see {@link zipAll}
  46. *
  47. * @return {Observable} An Observable emitting values from all the inner
  48. * Observables concatenated.
  49. * @method concatAll
  50. * @owner Observable
  51. */
  52. function concatAll() {
  53. return concatAll_1.concatAll()(this);
  54. }
  55. exports.concatAll = concatAll;
  56. //# sourceMappingURL=concatAll.js.map