1 import { AsyncScheduler } from './AsyncScheduler';
6 * <span class="informal">Schedule task as if you used setTimeout(task, duration)</span>
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
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.
17 * Use async scheduler to delay task
19 * import { asyncScheduler } from 'rxjs';
21 * const task = () => console.log('it works!');
23 * asyncScheduler.schedule(task, 2000);
25 * // After 2 seconds logs:
29 * Use async scheduler to repeat task in intervals
31 * import { asyncScheduler } from 'rxjs';
33 * function task(state) {
35 * this.schedule(state + 1, 1000); // `this` references currently executing Action,
36 * // which we reschedule with new state and delay
39 * asyncScheduler.schedule(task, 3000, 0);
48 export declare const asyncScheduler: AsyncScheduler;
50 * @deprecated renamed. Use {@link asyncScheduler}
52 export declare const async: AsyncScheduler;