a zip code crypto-currency system good for red ONLY

combineLatest.js 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { combineLatest as higherOrder } from '../operators/combineLatest';
  2. /* tslint:enable:max-line-length */
  3. /**
  4. * Combines multiple Observables to create an Observable whose values are
  5. * calculated from the latest values of each of its input Observables.
  6. *
  7. * <span class="informal">Whenever any input Observable emits a value, it
  8. * computes a formula using the latest values from all the inputs, then emits
  9. * the output of that formula.</span>
  10. *
  11. * <img src="./img/combineLatest.png" width="100%">
  12. *
  13. * `combineLatest` combines the values from this Observable with values from
  14. * Observables passed as arguments. This is done by subscribing to each
  15. * Observable, in order, and collecting an array of each of the most recent
  16. * values any time any of the input Observables emits, then either taking that
  17. * array and passing it as arguments to an optional `project` function and
  18. * emitting the return value of that, or just emitting the array of recent
  19. * values directly if there is no `project` function.
  20. *
  21. * @example <caption>Dynamically calculate the Body-Mass Index from an Observable of weight and one for height</caption>
  22. * var weight = Rx.Observable.of(70, 72, 76, 79, 75);
  23. * var height = Rx.Observable.of(1.76, 1.77, 1.78);
  24. * var bmi = weight.combineLatest(height, (w, h) => w / (h * h));
  25. * bmi.subscribe(x => console.log('BMI is ' + x));
  26. *
  27. * // With output to console:
  28. * // BMI is 24.212293388429753
  29. * // BMI is 23.93948099205209
  30. * // BMI is 23.671253629592222
  31. *
  32. * @see {@link combineAll}
  33. * @see {@link merge}
  34. * @see {@link withLatestFrom}
  35. *
  36. * @param {ObservableInput} other An input Observable to combine with the source
  37. * Observable. More than one input Observables may be given as argument.
  38. * @param {function} [project] An optional function to project the values from
  39. * the combined latest values into a new value on the output Observable.
  40. * @return {Observable} An Observable of projected values from the most recent
  41. * values from each input Observable, or an array of the most recent values from
  42. * each input Observable.
  43. * @method combineLatest
  44. * @owner Observable
  45. */
  46. export function combineLatest(...observables) {
  47. return higherOrder(...observables)(this);
  48. }
  49. //# sourceMappingURL=combineLatest.js.map