a zip code crypto-currency system good for red ONLY

sampleTime.js 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. "use strict";
  2. var async_1 = require('../scheduler/async');
  3. var sampleTime_1 = require('../operators/sampleTime');
  4. /**
  5. * Emits the most recently emitted value from the source Observable within
  6. * periodic time intervals.
  7. *
  8. * <span class="informal">Samples the source Observable at periodic time
  9. * intervals, emitting what it samples.</span>
  10. *
  11. * <img src="./img/sampleTime.png" width="100%">
  12. *
  13. * `sampleTime` periodically looks at the source Observable and emits whichever
  14. * value it has most recently emitted since the previous sampling, unless the
  15. * source has not emitted anything since the previous sampling. The sampling
  16. * happens periodically in time every `period` milliseconds (or the time unit
  17. * defined by the optional `scheduler` argument). The sampling starts as soon as
  18. * the output Observable is subscribed.
  19. *
  20. * @example <caption>Every second, emit the most recent click at most once</caption>
  21. * var clicks = Rx.Observable.fromEvent(document, 'click');
  22. * var result = clicks.sampleTime(1000);
  23. * result.subscribe(x => console.log(x));
  24. *
  25. * @see {@link auditTime}
  26. * @see {@link debounceTime}
  27. * @see {@link delay}
  28. * @see {@link sample}
  29. * @see {@link throttleTime}
  30. *
  31. * @param {number} period The sampling period expressed in milliseconds or the
  32. * time unit determined internally by the optional `scheduler`.
  33. * @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for
  34. * managing the timers that handle the sampling.
  35. * @return {Observable<T>} An Observable that emits the results of sampling the
  36. * values emitted by the source Observable at the specified time interval.
  37. * @method sampleTime
  38. * @owner Observable
  39. */
  40. function sampleTime(period, scheduler) {
  41. if (scheduler === void 0) { scheduler = async_1.async; }
  42. return sampleTime_1.sampleTime(period, scheduler)(this);
  43. }
  44. exports.sampleTime = sampleTime;
  45. //# sourceMappingURL=sampleTime.js.map