Front end of the Slack clone application.

concatAll.js 2.0KB

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