Front end of the Slack clone application.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. "use strict";
  2. var concatMap_1 = require('../operators/concatMap');
  3. /* tslint:enable:max-line-length */
  4. /**
  5. * Projects each source value to an Observable which is merged in the output
  6. * Observable, in a serialized fashion waiting for each one to complete before
  7. * merging the next.
  8. *
  9. * <span class="informal">Maps each value to an Observable, then flattens all of
  10. * these inner Observables using {@link concatAll}.</span>
  11. *
  12. * <img src="./img/concatMap.png" width="100%">
  13. *
  14. * Returns an Observable that emits items based on applying a function that you
  15. * supply to each item emitted by the source Observable, where that function
  16. * returns an (so-called "inner") Observable. Each new inner Observable is
  17. * concatenated with the previous inner Observable.
  18. *
  19. * __Warning:__ if source values arrive endlessly and faster than their
  20. * corresponding inner Observables can complete, it will result in memory issues
  21. * as inner Observables amass in an unbounded buffer waiting for their turn to
  22. * be subscribed to.
  23. *
  24. * Note: `concatMap` is equivalent to `mergeMap` with concurrency parameter set
  25. * to `1`.
  26. *
  27. * @example <caption>For each click event, tick every second from 0 to 3, with no concurrency</caption>
  28. * var clicks = Rx.Observable.fromEvent(document, 'click');
  29. * var result = clicks.concatMap(ev => Rx.Observable.interval(1000).take(4));
  30. * result.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 concat}
  39. * @see {@link concatAll}
  40. * @see {@link concatMapTo}
  41. * @see {@link exhaustMap}
  42. * @see {@link mergeMap}
  43. * @see {@link switchMap}
  44. *
  45. * @param {function(value: T, ?index: number): ObservableInput} project A function
  46. * that, when applied to an item emitted by the source Observable, returns an
  47. * Observable.
  48. * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector]
  49. * A function to produce the value on the output Observable based on the values
  50. * and the indices of the source (outer) emission and the inner Observable
  51. * emission. The arguments passed to this function are:
  52. * - `outerValue`: the value that came from the source
  53. * - `innerValue`: the value that came from the projected Observable
  54. * - `outerIndex`: the "index" of the value that came from the source
  55. * - `innerIndex`: the "index" of the value from the projected Observable
  56. * @return {Observable} An Observable that emits the result of applying the
  57. * projection function (and the optional `resultSelector`) to each item emitted
  58. * by the source Observable and taking values from each projected inner
  59. * Observable sequentially.
  60. * @method concatMap
  61. * @owner Observable
  62. */
  63. function concatMap(project, resultSelector) {
  64. return concatMap_1.concatMap(project, resultSelector)(this);
  65. }
  66. exports.concatMap = concatMap;
  67. //# sourceMappingURL=concatMap.js.map