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

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