UNPKG

2.39 kBTypeScriptView Raw
1import { Action } from './scheduler/Action';
2import { Subscription } from './Subscription';
3import { SchedulerLike, SchedulerAction } from './types';
4/**
5 * An execution context and a data structure to order tasks and schedule their
6 * execution. Provides a notion of (potentially virtual) time, through the
7 * `now()` getter method.
8 *
9 * Each unit of work in a Scheduler is called an `Action`.
10 *
11 * ```ts
12 * class Scheduler {
13 * now(): number;
14 * schedule(work, delay?, state?): Subscription;
15 * }
16 * ```
17 *
18 * @class Scheduler
19 * @deprecated Scheduler is an internal implementation detail of RxJS, and
20 * should not be used directly. Rather, create your own class and implement
21 * {@link SchedulerLike}. Will be made internal in v8.
22 */
23export declare class Scheduler implements SchedulerLike {
24 private schedulerActionCtor;
25 static now: () => number;
26 constructor(schedulerActionCtor: typeof Action, now?: () => number);
27 /**
28 * A getter method that returns a number representing the current time
29 * (at the time this function was called) according to the scheduler's own
30 * internal clock.
31 * @return {number} A number that represents the current time. May or may not
32 * have a relation to wall-clock time. May or may not refer to a time unit
33 * (e.g. milliseconds).
34 */
35 now: () => number;
36 /**
37 * Schedules a function, `work`, for execution. May happen at some point in
38 * the future, according to the `delay` parameter, if specified. May be passed
39 * some context object, `state`, which will be passed to the `work` function.
40 *
41 * The given arguments will be processed an stored as an Action object in a
42 * queue of actions.
43 *
44 * @param {function(state: ?T): ?Subscription} work A function representing a
45 * task, or some unit of work to be executed by the Scheduler.
46 * @param {number} [delay] Time to wait before executing the work, where the
47 * time unit is implicit and defined by the Scheduler itself.
48 * @param {T} [state] Some contextual data that the `work` function uses when
49 * called by the Scheduler.
50 * @return {Subscription} A subscription in order to be able to unsubscribe
51 * the scheduled work.
52 */
53 schedule<T>(work: (this: SchedulerAction<T>, state?: T) => void, delay?: number, state?: T): Subscription;
54}
55//# sourceMappingURL=Scheduler.d.ts.map
\No newline at end of file