Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

throttleTime.d.ts 2.1KB

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