a zip code crypto-currency system good for red ONLY

mergeAll.js 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /** PURE_IMPORTS_START .._operators_mergeAll PURE_IMPORTS_END */
  2. import { mergeAll as higherOrder } from '../operators/mergeAll';
  3. /**
  4. * Converts a higher-order Observable into a first-order Observable which
  5. * concurrently delivers all values that are emitted on the inner Observables.
  6. *
  7. * <span class="informal">Flattens an Observable-of-Observables.</span>
  8. *
  9. * <img src="./img/mergeAll.png" width="100%">
  10. *
  11. * `mergeAll` subscribes to an Observable that emits Observables, also known as
  12. * a higher-order Observable. Each time it observes one of these emitted inner
  13. * Observables, it subscribes to that and delivers all the values from the
  14. * inner Observable on the output Observable. The output Observable only
  15. * completes once all inner Observables have completed. Any error delivered by
  16. * a inner Observable will be immediately emitted on the output Observable.
  17. *
  18. * @example <caption>Spawn a new interval Observable for each click event, and blend their outputs as one Observable</caption>
  19. * var clicks = Rx.Observable.fromEvent(document, 'click');
  20. * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000));
  21. * var firstOrder = higherOrder.mergeAll();
  22. * firstOrder.subscribe(x => console.log(x));
  23. *
  24. * @example <caption>Count from 0 to 9 every second for each click, but only allow 2 concurrent timers</caption>
  25. * var clicks = Rx.Observable.fromEvent(document, 'click');
  26. * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000).take(10));
  27. * var firstOrder = higherOrder.mergeAll(2);
  28. * firstOrder.subscribe(x => console.log(x));
  29. *
  30. * @see {@link combineAll}
  31. * @see {@link concatAll}
  32. * @see {@link exhaust}
  33. * @see {@link merge}
  34. * @see {@link mergeMap}
  35. * @see {@link mergeMapTo}
  36. * @see {@link mergeScan}
  37. * @see {@link switch}
  38. * @see {@link zipAll}
  39. *
  40. * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of inner
  41. * Observables being subscribed to concurrently.
  42. * @return {Observable} An Observable that emits values coming from all the
  43. * inner Observables emitted by the source Observable.
  44. * @method mergeAll
  45. * @owner Observable
  46. */
  47. export function mergeAll(concurrent) {
  48. if (concurrent === void 0) {
  49. concurrent = Number.POSITIVE_INFINITY;
  50. }
  51. return higherOrder(concurrent)(this);
  52. }
  53. //# sourceMappingURL=mergeAll.js.map