source: trip-planner-front/node_modules/rxjs/internal/scheduler/async.d.ts@ 188ee53

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

initial commit

  • Property mode set to 100644
File size: 1.5 KB
Line 
1import { AsyncScheduler } from './AsyncScheduler';
2/**
3 *
4 * Async Scheduler
5 *
6 * <span class="informal">Schedule task as if you used setTimeout(task, duration)</span>
7 *
8 * `async` scheduler schedules tasks asynchronously, by putting them on the JavaScript
9 * event loop queue. It is best used to delay tasks in time or to schedule tasks repeating
10 * in intervals.
11 *
12 * If you just want to "defer" task, that is to perform it right after currently
13 * executing synchronous code ends (commonly achieved by `setTimeout(deferredTask, 0)`),
14 * better choice will be the {@link asapScheduler} scheduler.
15 *
16 * ## Examples
17 * Use async scheduler to delay task
18 * ```ts
19 * import { asyncScheduler } from 'rxjs';
20 *
21 * const task = () => console.log('it works!');
22 *
23 * asyncScheduler.schedule(task, 2000);
24 *
25 * // After 2 seconds logs:
26 * // "it works!"
27 * ```
28 *
29 * Use async scheduler to repeat task in intervals
30 * ```ts
31 * import { asyncScheduler } from 'rxjs';
32 *
33 * function task(state) {
34 * console.log(state);
35 * this.schedule(state + 1, 1000); // `this` references currently executing Action,
36 * // which we reschedule with new state and delay
37 * }
38 *
39 * asyncScheduler.schedule(task, 3000, 0);
40 *
41 * // Logs:
42 * // 0 after 3s
43 * // 1 after 4s
44 * // 2 after 5s
45 * // 3 after 6s
46 * ```
47 */
48export declare const asyncScheduler: AsyncScheduler;
49/**
50 * @deprecated renamed. Use {@link asyncScheduler}
51 */
52export declare const async: AsyncScheduler;
Note: See TracBrowser for help on using the repository browser.