a zip code crypto-currency system good for red ONLY

merge.js 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import { merge as mergeStatic } from '../observable/merge';
  2. export { merge as mergeStatic } from '../observable/merge';
  3. /* tslint:enable:max-line-length */
  4. /**
  5. * Creates an output Observable which concurrently emits all values from every
  6. * given input Observable.
  7. *
  8. * <span class="informal">Flattens multiple Observables together by blending
  9. * their values into one Observable.</span>
  10. *
  11. * <img src="./img/merge.png" width="100%">
  12. *
  13. * `merge` subscribes to each given input Observable (either the source or an
  14. * Observable given as argument), and simply forwards (without doing any
  15. * transformation) all the values from all the input Observables to the output
  16. * Observable. The output Observable only completes once all input Observables
  17. * have completed. Any error delivered by an input Observable will be immediately
  18. * emitted on the output Observable.
  19. *
  20. * @example <caption>Merge together two Observables: 1s interval and clicks</caption>
  21. * var clicks = Rx.Observable.fromEvent(document, 'click');
  22. * var timer = Rx.Observable.interval(1000);
  23. * var clicksOrTimer = clicks.merge(timer);
  24. * clicksOrTimer.subscribe(x => console.log(x));
  25. *
  26. * @example <caption>Merge together 3 Observables, but only 2 run concurrently</caption>
  27. * var timer1 = Rx.Observable.interval(1000).take(10);
  28. * var timer2 = Rx.Observable.interval(2000).take(6);
  29. * var timer3 = Rx.Observable.interval(500).take(10);
  30. * var concurrent = 2; // the argument
  31. * var merged = timer1.merge(timer2, timer3, concurrent);
  32. * merged.subscribe(x => console.log(x));
  33. *
  34. * @see {@link mergeAll}
  35. * @see {@link mergeMap}
  36. * @see {@link mergeMapTo}
  37. * @see {@link mergeScan}
  38. *
  39. * @param {ObservableInput} other An input Observable to merge with the source
  40. * Observable. More than one input Observables may be given as argument.
  41. * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input
  42. * Observables being subscribed to concurrently.
  43. * @param {Scheduler} [scheduler=null] The IScheduler to use for managing
  44. * concurrency of input Observables.
  45. * @return {Observable} An Observable that emits items that are the result of
  46. * every input Observable.
  47. * @method merge
  48. * @owner Observable
  49. */
  50. export function merge(...observables) {
  51. return (source) => source.lift.call(mergeStatic(source, ...observables));
  52. }
  53. //# sourceMappingURL=merge.js.map