This repository was archived by the owner on Apr 20, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
Copy pathrx.virtualtime.d.ts
101 lines (86 loc) · 3.77 KB
/
rx.virtualtime.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
declare module Rx {
export interface VirtualTimeScheduler<TAbsolute, TRelative> extends IScheduler {
clock: TAbsolute;
/**
* Adds a relative time value to an absolute time value.
* @param {Number} absolute Absolute virtual time value.
* @param {Number} relative Relative virtual time value to add.
* @return {Number} Resulting absolute virtual time sum value.
*/
add(from: TAbsolute, by: TRelative): TAbsolute;
/**
* Converts an absolute time to a number
* @param {Any} The absolute time.
* @returns {Number} The absolute time in ms
*/
toAbsoluteTime(duetime: TAbsolute): number;
/**
* Converts the TimeSpan value to a relative virtual time value.
* @param {Number} timeSpan TimeSpan value to convert.
* @return {Number} Corresponding relative virtual time value.
*/
toRelativeTime(duetime: number): TRelative;
/**
* Starts the virtual time scheduler.
*/
start(): IDisposable;
/**
* Stops the virtual time scheduler.
*/
stop(): void;
/**
* Advances the scheduler's clock to the specified time, running all work till that point.
* @param {Number} time Absolute time to advance the scheduler's clock to.
*/
advanceTo(time: TAbsolute): void;
/**
* Advances the scheduler's clock by the specified relative time, running all work scheduled for that timespan.
* @param {Number} time Relative time to advance the scheduler's clock by.
*/
advanceBy(time: TRelative): void;
/**
* Advances the scheduler's clock by the specified relative time.
* @param {Number} time Relative time to advance the scheduler's clock by.
*/
sleep(time: TRelative): void;
isEnabled: boolean;
/**
* Gets the next scheduled item to be executed.
* @returns {ScheduledItem} The next scheduled item.
*/
getNext(): internals.ScheduledItem<TAbsolute>;
/**
* Schedules an action to be executed at dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Any} dueTime Absolute time at which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
scheduleAbsolute(
state: any,
dueTime: TAbsolute,
action: (scheduler: VirtualTimeScheduler<TAbsolute, TRelative>, state: any) => any
): SingleAssignmentDisposable;
}
export var VirtualTimeScheduler: {
/**
* Creates a new historical scheduler with the specified initial clock value.
* @constructor
* @param {Any} initialClock Initial value for the clock.
* @param {Function} comparer Comparer to determine causality of events based on absolute time.
*/
new <TAbsolute, TRelative>(initialClock: TAbsolute, comparer: _Comparer<TAbsolute, TRelative>): VirtualTimeScheduler<TAbsolute, TRelative>;
};
export interface HistoricalScheduler extends VirtualTimeScheduler<number, number> {
}
export var HistoricalScheduler: {
/**
* Creates a new historical scheduler with the specified initial clock value.
* @constructor
* @param {Number} initialClock Initial value for the clock.
* @param {Function} comparer Comparer to determine causality of events based on absolute time.
*/
new (initialClock: number, comparer: _Comparer<number, number>): HistoricalScheduler;
};
}
declare module "rx.virtualtime" { export = Rx; }