Front end of the Slack clone application.

concat.js 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /** PURE_IMPORTS_START .._operators_concat PURE_IMPORTS_END */
  2. import { concat as higherOrder } from '../operators/concat';
  3. export { concat as concatStatic } from '../observable/concat';
  4. /* tslint:enable:max-line-length */
  5. /**
  6. * Creates an output Observable which sequentially emits all values from every
  7. * given input Observable after the current Observable.
  8. *
  9. * <span class="informal">Concatenates multiple Observables together by
  10. * sequentially emitting their values, one Observable after the other.</span>
  11. *
  12. * <img src="./img/concat.png" width="100%">
  13. *
  14. * Joins this Observable with multiple other Observables by subscribing to them
  15. * one at a time, starting with the source, and merging their results into the
  16. * output Observable. Will wait for each Observable to complete before moving
  17. * on to the next.
  18. *
  19. * @example <caption>Concatenate a timer counting from 0 to 3 with a synchronous sequence from 1 to 10</caption>
  20. * var timer = Rx.Observable.interval(1000).take(4);
  21. * var sequence = Rx.Observable.range(1, 10);
  22. * var result = timer.concat(sequence);
  23. * result.subscribe(x => console.log(x));
  24. *
  25. * // results in:
  26. * // 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3 -immediate-> 1 ... 10
  27. *
  28. * @example <caption>Concatenate 3 Observables</caption>
  29. * var timer1 = Rx.Observable.interval(1000).take(10);
  30. * var timer2 = Rx.Observable.interval(2000).take(6);
  31. * var timer3 = Rx.Observable.interval(500).take(10);
  32. * var result = timer1.concat(timer2, timer3);
  33. * result.subscribe(x => console.log(x));
  34. *
  35. * // results in the following:
  36. * // (Prints to console sequentially)
  37. * // -1000ms-> 0 -1000ms-> 1 -1000ms-> ... 9
  38. * // -2000ms-> 0 -2000ms-> 1 -2000ms-> ... 5
  39. * // -500ms-> 0 -500ms-> 1 -500ms-> ... 9
  40. *
  41. * @see {@link concatAll}
  42. * @see {@link concatMap}
  43. * @see {@link concatMapTo}
  44. *
  45. * @param {ObservableInput} other An input Observable to concatenate after the source
  46. * Observable. More than one input Observables may be given as argument.
  47. * @param {Scheduler} [scheduler=null] An optional IScheduler to schedule each
  48. * Observable subscription on.
  49. * @return {Observable} All values of each passed Observable merged into a
  50. * single Observable, in order, in serial fashion.
  51. * @method concat
  52. * @owner Observable
  53. */
  54. export function concat() {
  55. var observables = [];
  56. for (var _i = 0; _i < arguments.length; _i++) {
  57. observables[_i - 0] = arguments[_i];
  58. }
  59. return higherOrder.apply(void 0, observables)(this);
  60. }
  61. //# sourceMappingURL=concat.js.map