source: trip-planner-front/node_modules/rxjs/internal/scheduler/queue.d.ts@ 59329aa

Last change on this file since 59329aa was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.0 KB
Line 
1import { 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 */
64export declare const queueScheduler: QueueScheduler;
65/**
66 * @deprecated renamed. Use {@link queueScheduler}
67 */
68export declare const queue: QueueScheduler;
Note: See TracBrowser for help on using the repository browser.