Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

delay.d.ts 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. * ```ts
  21. * import { fromEvent } from 'rxjs';
  22. * import { delay } from 'rxjs/operators';
  23. *
  24. * const clicks = fromEvent(document, 'click');
  25. * const delayedClicks = clicks.pipe(delay(1000)); // each click emitted after 1 second
  26. * delayedClicks.subscribe(x => console.log(x));
  27. * ```
  28. *
  29. * Delay all clicks until a future date happens
  30. * ```ts
  31. * import { fromEvent } from 'rxjs';
  32. * import { delay } from 'rxjs/operators';
  33. *
  34. * const clicks = fromEvent(document, 'click');
  35. * const date = new Date('March 15, 2050 12:00:00'); // in the future
  36. * const delayedClicks = clicks.pipe(delay(date)); // click emitted only after that date
  37. * delayedClicks.subscribe(x => console.log(x));
  38. * ```
  39. *
  40. * @see {@link debounceTime}
  41. * @see {@link delayWhen}
  42. *
  43. * @param {number|Date} delay The delay duration in milliseconds (a `number`) or
  44. * a `Date` until which the emission of the source items is delayed.
  45. * @param {SchedulerLike} [scheduler=async] The {@link SchedulerLike} to use for
  46. * managing the timers that handle the time-shift for each item.
  47. * @return {Observable} An Observable that delays the emissions of the source
  48. * Observable by the specified timeout or Date.
  49. * @method delay
  50. * @owner Observable
  51. */
  52. export declare function delay<T>(delay: number | Date, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;