a zip code crypto-currency system good for red ONLY

throttleTime.js 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { async } from '../scheduler/async';
  2. import { defaultThrottleConfig } from '../operators/throttle';
  3. import { throttleTime as higherOrder } from '../operators/throttleTime';
  4. /**
  5. * Emits a value from the source Observable, then ignores subsequent source
  6. * values for `duration` milliseconds, then repeats this process.
  7. *
  8. * <span class="informal">Lets a value pass, then ignores source values for the
  9. * next `duration` milliseconds.</span>
  10. *
  11. * <img src="./img/throttleTime.png" width="100%">
  12. *
  13. * `throttleTime` emits the source Observable values on the output Observable
  14. * when its internal timer is disabled, and ignores source values when the timer
  15. * is enabled. Initially, the timer is disabled. As soon as the first source
  16. * value arrives, it is forwarded to the output Observable, and then the timer
  17. * is enabled. After `duration` milliseconds (or the time unit determined
  18. * internally by the optional `scheduler`) has passed, the timer is disabled,
  19. * and this process repeats for the next source value. Optionally takes a
  20. * {@link IScheduler} for managing timers.
  21. *
  22. * @example <caption>Emit clicks at a rate of at most one click per second</caption>
  23. * var clicks = Rx.Observable.fromEvent(document, 'click');
  24. * var result = clicks.throttleTime(1000);
  25. * result.subscribe(x => console.log(x));
  26. *
  27. * @see {@link auditTime}
  28. * @see {@link debounceTime}
  29. * @see {@link delay}
  30. * @see {@link sampleTime}
  31. * @see {@link throttle}
  32. *
  33. * @param {number} duration Time to wait before emitting another value after
  34. * emitting the last value, measured in milliseconds or the time unit determined
  35. * internally by the optional `scheduler`.
  36. * @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for
  37. * managing the timers that handle the throttling.
  38. * @return {Observable<T>} An Observable that performs the throttle operation to
  39. * limit the rate of emissions from the source.
  40. * @method throttleTime
  41. * @owner Observable
  42. */
  43. export function throttleTime(duration, scheduler = async, config = defaultThrottleConfig) {
  44. return higherOrder(duration, scheduler, config)(this);
  45. }
  46. //# sourceMappingURL=throttleTime.js.map