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.

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 asyncScheduler} 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
  19. * Schedule recursively first, then do something
  20. * ```javascript
  21. * Rx.Scheduler.queue.schedule(() => {
  22. * Rx.Scheduler.queue.schedule(() => console.log('second')); // will not happen now, but will be put on a queue
  23. *
  24. * console.log('first');
  25. * });
  26. *
  27. * // Logs:
  28. * // "first"
  29. * // "second"
  30. * ```
  31. *
  32. * Reschedule itself recursively
  33. * ```javascript
  34. * Rx.Scheduler.queue.schedule(function(state) {
  35. * if (state !== 0) {
  36. * console.log('before', state);
  37. * this.schedule(state - 1); // `this` references currently executing Action,
  38. * // which we reschedule with new state
  39. * console.log('after', state);
  40. * }
  41. * }, 0, 3);
  42. *
  43. * // In scheduler that runs recursively, you would expect:
  44. * // "before", 3
  45. * // "before", 2
  46. * // "before", 1
  47. * // "after", 1
  48. * // "after", 2
  49. * // "after", 3
  50. *
  51. * // But with queue it logs:
  52. * // "before", 3
  53. * // "after", 3
  54. * // "before", 2
  55. * // "after", 2
  56. * // "before", 1
  57. * // "after", 1
  58. * ```
  59. *
  60. * @static true
  61. * @name queue
  62. * @owner Scheduler
  63. */
  64. export declare const queue: QueueScheduler;