UNPKG

2.45 kBTypeScriptView Raw
1import { AsyncAction } from './AsyncAction';
2import { Subscription } from '../Subscription';
3import { AsyncScheduler } from './AsyncScheduler';
4import { SchedulerAction } from '../types';
5import { TimerHandle } from './timerHandle';
6export declare class VirtualTimeScheduler extends AsyncScheduler {
7 maxFrames: number;
8 /** @deprecated Not used in VirtualTimeScheduler directly. Will be removed in v8. */
9 static frameTimeFactor: number;
10 /**
11 * The current frame for the state of the virtual scheduler instance. The difference
12 * between two "frames" is synonymous with the passage of "virtual time units". So if
13 * you record `scheduler.frame` to be `1`, then later, observe `scheduler.frame` to be at `11`,
14 * that means `10` virtual time units have passed.
15 */
16 frame: number;
17 /**
18 * Used internally to examine the current virtual action index being processed.
19 * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.
20 */
21 index: number;
22 /**
23 * This creates an instance of a `VirtualTimeScheduler`. Experts only. The signature of
24 * this constructor is likely to change in the long run.
25 *
26 * @param schedulerActionCtor The type of Action to initialize when initializing actions during scheduling.
27 * @param maxFrames The maximum number of frames to process before stopping. Used to prevent endless flush cycles.
28 */
29 constructor(schedulerActionCtor?: typeof AsyncAction, maxFrames?: number);
30 /**
31 * Prompt the Scheduler to execute all of its queued actions, therefore
32 * clearing its queue.
33 * @return {void}
34 */
35 flush(): void;
36}
37export declare class VirtualAction<T> extends AsyncAction<T> {
38 protected scheduler: VirtualTimeScheduler;
39 protected work: (this: SchedulerAction<T>, state?: T) => void;
40 protected index: number;
41 protected active: boolean;
42 constructor(scheduler: VirtualTimeScheduler, work: (this: SchedulerAction<T>, state?: T) => void, index?: number);
43 schedule(state?: T, delay?: number): Subscription;
44 protected requestAsyncId(scheduler: VirtualTimeScheduler, id?: any, delay?: number): TimerHandle;
45 protected recycleAsyncId(scheduler: VirtualTimeScheduler, id?: any, delay?: number): TimerHandle | undefined;
46 protected _execute(state: T, delay: number): any;
47 private static sortActions;
48}
49//# sourceMappingURL=VirtualTimeScheduler.d.ts.map
\No newline at end of file