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.

auditTime.d.ts 2.1KB

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