a zip code crypto-currency system good for red ONLY

mergeAll.js 2.1KB

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