Debian Codegraph @

node/rxjs/dist/types/internal/Scheduler.d.ts

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