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.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. * ```ts
  28. * import { fromEvent } from 'rxjs';
  29. * import { debounceTime } from 'rxjs/operators';
  30. *
  31. * const clicks = fromEvent(document, 'click');
  32. * const result = clicks.pipe(debounceTime(1000));
  33. * result.subscribe(x => console.log(x));
  34. * ```
  35. *
  36. * @see {@link auditTime}
  37. * @see {@link debounce}
  38. * @see {@link delay}
  39. * @see {@link sampleTime}
  40. * @see {@link throttleTime}
  41. *
  42. * @param {number} dueTime The timeout duration in milliseconds (or the time
  43. * unit determined internally by the optional `scheduler`) for the window of
  44. * time required to wait for emission silence before emitting the most recent
  45. * source value.
  46. * @param {SchedulerLike} [scheduler=async] The {@link SchedulerLike} to use for
  47. * managing the timers that handle the timeout for each value.
  48. * @return {Observable} An Observable that delays the emissions of the source
  49. * Observable by the specified `dueTime`, and may drop some values if they occur
  50. * too frequently.
  51. * @method debounceTime
  52. * @owner Observable
  53. */
  54. export declare function debounceTime<T>(dueTime: number, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;