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.

debounceTime.d.ts 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { MonoTypeOperatorFunction, SchedulerLike } from '../types';
  2. /**
  3. * Emits a value from the source Observable only after a particular time span
  4. * has passed without another source emission.
  5. *
  6. * <span class="informal">It's like {@link delay}, but passes only the most
  7. * recent value from each burst of emissions.</span>
  8. *
  9. * ![](debounceTime.png)
  10. *
  11. * `debounceTime` delays values emitted by the source Observable, but drops
  12. * previous pending delayed emissions if a new value arrives on the source
  13. * Observable. This operator keeps track of the most recent value from the
  14. * source Observable, and emits that only when `dueTime` enough time has passed
  15. * without any other value appearing on the source Observable. If a new value
  16. * appears before `dueTime` silence occurs, the previous value will be dropped
  17. * and will not be emitted on the output Observable.
  18. *
  19. * This is a rate-limiting operator, because it is impossible for more than one
  20. * value to be emitted in any time window of duration `dueTime`, but it is also
  21. * a delay-like operator since output emissions do not occur at the same time as
  22. * they did on the source Observable. Optionally takes a {@link SchedulerLike} for
  23. * managing timers.
  24. *
  25. * ## Example
  26. * Emit the most recent click after a burst of clicks
  27. * ```javascript
  28. * const clicks = fromEvent(document, 'click');
  29. * const result = clicks.pipe(debounceTime(1000));
  30. * result.subscribe(x => console.log(x));
  31. * ```
  32. *
  33. * @see {@link auditTime}
  34. * @see {@link debounce}
  35. * @see {@link delay}
  36. * @see {@link sampleTime}
  37. * @see {@link throttleTime}
  38. *
  39. * @param {number} dueTime The timeout duration in milliseconds (or the time
  40. * unit determined internally by the optional `scheduler`) for the window of
  41. * time required to wait for emission silence before emitting the most recent
  42. * source value.
  43. * @param {SchedulerLike} [scheduler=async] The {@link SchedulerLike} to use for
  44. * managing the timers that handle the timeout for each value.
  45. * @return {Observable} An Observable that delays the emissions of the source
  46. * Observable by the specified `dueTime`, and may drop some values if they occur
  47. * too frequently.
  48. * @method debounceTime
  49. * @owner Observable
  50. */
  51. export declare function debounceTime<T>(dueTime: number, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;