a zip code crypto-currency system good for red ONLY

delay.js 1.9KB

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