a zip code crypto-currency system good for red ONLY

mergeMapTo.js 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { mergeMapTo as higherOrder } from '../operators/mergeMapTo';
  2. /* tslint:enable:max-line-length */
  3. /**
  4. * Projects each source value to the same Observable which is merged multiple
  5. * times in the output Observable.
  6. *
  7. * <span class="informal">It's like {@link mergeMap}, but maps each value always
  8. * to the same inner Observable.</span>
  9. *
  10. * <img src="./img/mergeMapTo.png" width="100%">
  11. *
  12. * Maps each source value to the given Observable `innerObservable` regardless
  13. * of the source value, and then merges those resulting Observables into one
  14. * single Observable, which is the output Observable.
  15. *
  16. * @example <caption>For each click event, start an interval Observable ticking every 1 second</caption>
  17. * var clicks = Rx.Observable.fromEvent(document, 'click');
  18. * var result = clicks.mergeMapTo(Rx.Observable.interval(1000));
  19. * result.subscribe(x => console.log(x));
  20. *
  21. * @see {@link concatMapTo}
  22. * @see {@link merge}
  23. * @see {@link mergeAll}
  24. * @see {@link mergeMap}
  25. * @see {@link mergeScan}
  26. * @see {@link switchMapTo}
  27. *
  28. * @param {ObservableInput} innerObservable An Observable to replace each value from
  29. * the source Observable.
  30. * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector]
  31. * A function to produce the value on the output Observable based on the values
  32. * and the indices of the source (outer) emission and the inner Observable
  33. * emission. The arguments passed to this function are:
  34. * - `outerValue`: the value that came from the source
  35. * - `innerValue`: the value that came from the projected Observable
  36. * - `outerIndex`: the "index" of the value that came from the source
  37. * - `innerIndex`: the "index" of the value from the projected Observable
  38. * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input
  39. * Observables being subscribed to concurrently.
  40. * @return {Observable} An Observable that emits items from the given
  41. * `innerObservable` (and optionally transformed through `resultSelector`) every
  42. * time a value is emitted on the source Observable.
  43. * @method mergeMapTo
  44. * @owner Observable
  45. */
  46. export function mergeMapTo(innerObservable, resultSelector, concurrent = Number.POSITIVE_INFINITY) {
  47. return higherOrder(innerObservable, resultSelector, concurrent)(this);
  48. }
  49. //# sourceMappingURL=mergeMapTo.js.map