1 import { QueueScheduler } from './QueueScheduler';
6 * <span class="informal">Put every next task on a queue, instead of executing it immediately</span>
8 * `queue` scheduler, when used with delay, behaves the same as {@link asyncScheduler} scheduler.
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.
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.
19 * Schedule recursively first, then do something
21 * import { queueScheduler } from 'rxjs';
23 * queueScheduler.schedule(() => {
24 * queueScheduler.schedule(() => console.log('second')); // will not happen now, but will be put on a queue
26 * console.log('first');
34 * Reschedule itself recursively
36 * import { queueScheduler } from 'rxjs';
38 * queueScheduler.schedule(function(state) {
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);
47 * // In scheduler that runs recursively, you would expect:
55 * // But with queue it logs:
64 export declare const queueScheduler: QueueScheduler;
66 * @deprecated renamed. Use {@link queueScheduler}
68 export declare const queue: QueueScheduler;