a zip code crypto-currency system good for red ONLY

auditTime.js 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /** PURE_IMPORTS_START .._scheduler_async,.._operators_auditTime PURE_IMPORTS_END */
  2. import { async } from '../scheduler/async';
  3. import { auditTime as higherOrder } from '../operators/auditTime';
  4. /**
  5. * Ignores source values for `duration` milliseconds, then emits the most recent
  6. * value from the source Observable, then repeats this process.
  7. *
  8. * <span class="informal">When it sees a source values, it ignores that plus
  9. * the next ones for `duration` milliseconds, and then it emits the most recent
  10. * value from the source.</span>
  11. *
  12. * <img src="./img/auditTime.png" width="100%">
  13. *
  14. * `auditTime` is similar to `throttleTime`, but emits the last value from the
  15. * silenced time window, instead of the first value. `auditTime` emits the most
  16. * recent value from the source Observable on the output Observable as soon as
  17. * its internal timer becomes disabled, and ignores source values while the
  18. * timer is enabled. Initially, the timer is disabled. As soon as the first
  19. * source value arrives, the timer is enabled. After `duration` milliseconds (or
  20. * the time unit determined internally by the optional `scheduler`) has passed,
  21. * the timer is disabled, then the most recent source value is emitted on the
  22. * output Observable, and this process repeats for the next source value.
  23. * Optionally takes a {@link IScheduler} for managing timers.
  24. *
  25. * @example <caption>Emit clicks at a rate of at most one click per second</caption>
  26. * var clicks = Rx.Observable.fromEvent(document, 'click');
  27. * var result = clicks.auditTime(1000);
  28. * result.subscribe(x => console.log(x));
  29. *
  30. * @see {@link audit}
  31. * @see {@link debounceTime}
  32. * @see {@link delay}
  33. * @see {@link sampleTime}
  34. * @see {@link throttleTime}
  35. *
  36. * @param {number} duration Time to wait before emitting the most recent source
  37. * value, measured in milliseconds or the time unit determined internally
  38. * by the optional `scheduler`.
  39. * @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for
  40. * managing the timers that handle the rate-limiting behavior.
  41. * @return {Observable<T>} An Observable that performs rate-limiting of
  42. * emissions from the source Observable.
  43. * @method auditTime
  44. * @owner Observable
  45. */
  46. export function auditTime(duration, scheduler) {
  47. if (scheduler === void 0) {
  48. scheduler = async;
  49. }
  50. return higherOrder(duration, scheduler)(this);
  51. }
  52. //# sourceMappingURL=auditTime.js.map