import { AsapAction } from './AsapAction'; import { AsapScheduler } from './AsapScheduler'; /** * * Asap Scheduler * * <span class="informal">Perform task as fast as it can be performed asynchronously</span> * * `asap` scheduler behaves the same as {@link asyncScheduler} scheduler when you use it to delay task * in time. If however you set delay to `0`, `asap` will wait for current synchronously executing * code to end and then it will try to execute given task as fast as possible. * * `asap` scheduler will do its best to minimize time between end of currently executing code * and start of scheduled task. This makes it best candidate for performing so called "deferring". * Traditionally this was achieved by calling `setTimeout(deferredTask, 0)`, but that technique involves * some (although minimal) unwanted delay. * * Note that using `asap` scheduler does not necessarily mean that your task will be first to process * after currently executing code. In particular, if some task was also scheduled with `asap` before, * that task will execute first. That being said, if you need to schedule task asynchronously, but * as soon as possible, `asap` scheduler is your best bet. * * ## Example * Compare async and asap scheduler< * ```ts * import { asapScheduler, asyncScheduler } from 'rxjs'; * * asyncScheduler.schedule(() => console.log('async')); // scheduling 'async' first... * asapScheduler.schedule(() => console.log('asap')); * * // Logs: * // "asap" * // "async" * // ... but 'asap' goes first! * ``` */ export const asapScheduler = new AsapScheduler(AsapAction); /** * @deprecated renamed. Use {@link asapScheduler} */ export const asap = asapScheduler;
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
Action.ts | File | 1.28 KB | 0644 |
|
AnimationFrameAction.ts | File | 1.99 KB | 0644 |
|
AnimationFrameScheduler.ts | File | 756 B | 0644 |
|
AsapAction.ts | File | 1.96 KB | 0644 |
|
AsapScheduler.ts | File | 746 B | 0644 |
|
AsyncAction.ts | File | 4.8 KB | 0644 |
|
AsyncScheduler.ts | File | 1.93 KB | 0644 |
|
QueueAction.ts | File | 1.4 KB | 0644 |
|
QueueScheduler.ts | File | 107 B | 0644 |
|
VirtualTimeScheduler.ts | File | 2.99 KB | 0644 |
|
animationFrame.ts | File | 1.35 KB | 0644 |
|
asap.ts | File | 1.67 KB | 0644 |
|
async.ts | File | 1.5 KB | 0644 |
|
queue.ts | File | 2.03 KB | 0644 |
|