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.

delay.d.ts 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { MonoTypeOperatorFunction, SchedulerLike } from '../types';
  2. /**
  3. * Delays the emission of items from the source Observable by a given timeout or
  4. * until a given Date.
  5. *
  6. * <span class="informal">Time shifts each item by some specified amount of
  7. * milliseconds.</span>
  8. *
  9. * ![](delay.png)
  10. *
  11. * If the delay argument is a Number, this operator time shifts the source
  12. * Observable by that amount of time expressed in milliseconds. The relative
  13. * time intervals between the values are preserved.
  14. *
  15. * If the delay argument is a Date, this operator time shifts the start of the
  16. * Observable execution until the given date occurs.
  17. *
  18. * ## Examples
  19. * Delay each click by one second
  20. * ```javascript
  21. * const clicks = fromEvent(document, 'click');
  22. * const delayedClicks = clicks.pipe(delay(1000)); // each click emitted after 1 second
  23. * delayedClicks.subscribe(x => console.log(x));
  24. * ```
  25. *
  26. * Delay all clicks until a future date happens
  27. * ```javascript
  28. * const clicks = fromEvent(document, 'click');
  29. * const date = new Date('March 15, 2050 12:00:00'); // in the future
  30. * const delayedClicks = clicks.pipe(delay(date)); // click emitted only after that date
  31. * delayedClicks.subscribe(x => console.log(x));
  32. * ```
  33. *
  34. * @see {@link debounceTime}
  35. * @see {@link delayWhen}
  36. *
  37. * @param {number|Date} delay The delay duration in milliseconds (a `number`) or
  38. * a `Date` until which the emission of the source items is delayed.
  39. * @param {SchedulerLike} [scheduler=async] The {@link SchedulerLike} to use for
  40. * managing the timers that handle the time-shift for each item.
  41. * @return {Observable} An Observable that delays the emissions of the source
  42. * Observable by the specified timeout or Date.
  43. * @method delay
  44. * @owner Observable
  45. */
  46. export declare function delay<T>(delay: number | Date, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;