1 import { AsapAction } from './AsapAction';
2 import { AsapScheduler } from './AsapScheduler';
8 * <span class="informal">Perform task as fast as it can be performed asynchronously</span>
10 * `asap` scheduler behaves the same as {@link asyncScheduler} scheduler when you use it to delay task
11 * in time. If however you set delay to `0`, `asap` will wait for current synchronously executing
12 * code to end and then it will try to execute given task as fast as possible.
14 * `asap` scheduler will do its best to minimize time between end of currently executing code
15 * and start of scheduled task. This makes it best candidate for performing so called "deferring".
16 * Traditionally this was achieved by calling `setTimeout(deferredTask, 0)`, but that technique involves
17 * some (although minimal) unwanted delay.
19 * Note that using `asap` scheduler does not necessarily mean that your task will be first to process
20 * after currently executing code. In particular, if some task was also scheduled with `asap` before,
21 * that task will execute first. That being said, if you need to schedule task asynchronously, but
22 * as soon as possible, `asap` scheduler is your best bet.
25 * Compare async and asap scheduler<
27 * import { asapScheduler, asyncScheduler } from 'rxjs';
29 * asyncScheduler.schedule(() => console.log('async')); // scheduling 'async' first...
30 * asapScheduler.schedule(() => console.log('asap'));
35 * // ... but 'asap' goes first!
38 export const asapScheduler = new AsapScheduler(AsapAction);
41 * @deprecated renamed. Use {@link asapScheduler}
43 export const asap = asapScheduler;