a zip code crypto-currency system good for red ONLY

sample.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { sample as higherOrder } from '../operators/sample';
  2. /**
  3. * Emits the most recently emitted value from the source Observable whenever
  4. * another Observable, the `notifier`, emits.
  5. *
  6. * <span class="informal">It's like {@link sampleTime}, but samples whenever
  7. * the `notifier` Observable emits something.</span>
  8. *
  9. * <img src="./img/sample.png" width="100%">
  10. *
  11. * Whenever the `notifier` Observable emits a value or completes, `sample`
  12. * looks at the source Observable and emits whichever value it has most recently
  13. * emitted since the previous sampling, unless the source has not emitted
  14. * anything since the previous sampling. The `notifier` is subscribed to as soon
  15. * as the output Observable is subscribed.
  16. *
  17. * @example <caption>On every click, sample the most recent "seconds" timer</caption>
  18. * var seconds = Rx.Observable.interval(1000);
  19. * var clicks = Rx.Observable.fromEvent(document, 'click');
  20. * var result = seconds.sample(clicks);
  21. * result.subscribe(x => console.log(x));
  22. *
  23. * @see {@link audit}
  24. * @see {@link debounce}
  25. * @see {@link sampleTime}
  26. * @see {@link throttle}
  27. *
  28. * @param {Observable<any>} notifier The Observable to use for sampling the
  29. * source Observable.
  30. * @return {Observable<T>} An Observable that emits the results of sampling the
  31. * values emitted by the source Observable whenever the notifier Observable
  32. * emits value or completes.
  33. * @method sample
  34. * @owner Observable
  35. */
  36. export function sample(notifier) {
  37. return higherOrder(notifier)(this);
  38. }
  39. //# sourceMappingURL=sample.js.map