a zip code crypto-currency system good for red ONLY

queue.d.ts 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import { QueueScheduler } from './QueueScheduler';
  2. /**
  3. *
  4. * Queue Scheduler
  5. *
  6. * <span class="informal">Put every next task on a queue, instead of executing it immediately</span>
  7. *
  8. * `queue` scheduler, when used with delay, behaves the same as {@link async} scheduler.
  9. *
  10. * When used without delay, it schedules given task synchronously - executes it right when
  11. * it is scheduled. However when called recursively, that is when inside the scheduled task,
  12. * another task is scheduled with queue scheduler, instead of executing immediately as well,
  13. * that task will be put on a queue and wait for current one to finish.
  14. *
  15. * This means that when you execute task with `queue` scheduler, you are sure it will end
  16. * before any other task scheduled with that scheduler will start.
  17. *
  18. * @examples <caption>Schedule recursively first, then do something</caption>
  19. *
  20. * Rx.Scheduler.queue.schedule(() => {
  21. * Rx.Scheduler.queue.schedule(() => console.log('second')); // will not happen now, but will be put on a queue
  22. *
  23. * console.log('first');
  24. * });
  25. *
  26. * // Logs:
  27. * // "first"
  28. * // "second"
  29. *
  30. *
  31. * @example <caption>Reschedule itself recursively</caption>
  32. *
  33. * Rx.Scheduler.queue.schedule(function(state) {
  34. * if (state !== 0) {
  35. * console.log('before', state);
  36. * this.schedule(state - 1); // `this` references currently executing Action,
  37. * // which we reschedule with new state
  38. * console.log('after', state);
  39. * }
  40. * }, 0, 3);
  41. *
  42. * // In scheduler that runs recursively, you would expect:
  43. * // "before", 3
  44. * // "before", 2
  45. * // "before", 1
  46. * // "after", 1
  47. * // "after", 2
  48. * // "after", 3
  49. *
  50. * // But with queue it logs:
  51. * // "before", 3
  52. * // "after", 3
  53. * // "before", 2
  54. * // "after", 2
  55. * // "before", 1
  56. * // "after", 1
  57. *
  58. *
  59. * @static true
  60. * @name queue
  61. * @owner Scheduler
  62. */
  63. export declare const queue: QueueScheduler;