Skip to content
This repository was archived by the owner on Apr 20, 2018. It is now read-only.

Commit 6020452

Browse files
pablobirukovmattpodwysocki
authored andcommitted
export VirtualTimeSchedulers' constructor (#1339)
* export VirtualTimeSchedulers as constructor * export `clock` property. Add VirtualTimeScheduler to rx.all * add generic types to VirtualTimeScheduler
1 parent 0a2d115 commit 6020452

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed

ts/rx.all.d.ts

+24
Original file line numberDiff line numberDiff line change
@@ -4767,6 +4767,7 @@ declare module Rx {
47674767
}
47684768

47694769
export interface VirtualTimeScheduler<TAbsolute, TRelative> extends IScheduler {
4770+
clock: TAbsolute;
47704771
/**
47714772
* Adds a relative time value to an absolute time value.
47724773
* @param {Number} absolute Absolute virtual time value.
@@ -4824,8 +4825,31 @@ declare module Rx {
48244825
* @returns {ScheduledItem} The next scheduled item.
48254826
*/
48264827
getNext(): internals.ScheduledItem<TAbsolute>;
4828+
4829+
/**
4830+
* Schedules an action to be executed at dueTime.
4831+
* @param {Mixed} state State passed to the action to be executed.
4832+
* @param {Any} dueTime Absolute time at which to execute the action.
4833+
* @param {Function} action Action to be executed.
4834+
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
4835+
*/
4836+
scheduleAbsolute(
4837+
state: any,
4838+
dueTime: TAbsolute,
4839+
action: (scheduler: VirtualTimeScheduler<TAbsolute, TRelative>, state: any) => any
4840+
): SingleAssignmentDisposable;
48274841
}
48284842

4843+
export var VirtualTimeScheduler: {
4844+
/**
4845+
* Creates a new historical scheduler with the specified initial clock value.
4846+
* @constructor
4847+
* @param {Any} initialClock Initial value for the clock.
4848+
* @param {Function} comparer Comparer to determine causality of events based on absolute time.
4849+
*/
4850+
new <TAbsolute, TRelative>(initialClock: TAbsolute, comparer: _Comparer<TAbsolute, TRelative>): VirtualTimeScheduler<TAbsolute, TRelative>;
4851+
};
4852+
48294853
export interface HistoricalScheduler extends VirtualTimeScheduler<number, number> {
48304854
}
48314855

ts/rx.all.es6.d.ts

+24
Original file line numberDiff line numberDiff line change
@@ -4789,6 +4789,7 @@ declare module Rx {
47894789
}
47904790

47914791
export interface VirtualTimeScheduler<TAbsolute, TRelative> extends IScheduler {
4792+
clock: TAbsolute;
47924793
/**
47934794
* Adds a relative time value to an absolute time value.
47944795
* @param {Number} absolute Absolute virtual time value.
@@ -4846,8 +4847,31 @@ declare module Rx {
48464847
* @returns {ScheduledItem} The next scheduled item.
48474848
*/
48484849
getNext(): internals.ScheduledItem<TAbsolute>;
4850+
4851+
/**
4852+
* Schedules an action to be executed at dueTime.
4853+
* @param {Mixed} state State passed to the action to be executed.
4854+
* @param {Any} dueTime Absolute time at which to execute the action.
4855+
* @param {Function} action Action to be executed.
4856+
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
4857+
*/
4858+
scheduleAbsolute(
4859+
state: any,
4860+
dueTime: TAbsolute,
4861+
action: (scheduler: VirtualTimeScheduler<TAbsolute, TRelative>, state: any) => any
4862+
): SingleAssignmentDisposable;
48494863
}
48504864

4865+
export var VirtualTimeScheduler: {
4866+
/**
4867+
* Creates a new historical scheduler with the specified initial clock value.
4868+
* @constructor
4869+
* @param {Any} initialClock Initial value for the clock.
4870+
* @param {Function} comparer Comparer to determine causality of events based on absolute time.
4871+
*/
4872+
new <TAbsolute, TRelative>(initialClock: TAbsolute, comparer: _Comparer<TAbsolute, TRelative>): VirtualTimeScheduler<TAbsolute, TRelative>;
4873+
};
4874+
48514875
export interface HistoricalScheduler extends VirtualTimeScheduler<number, number> {
48524876
}
48534877

ts/rx.virtualtime.d.ts

+24
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
declare module Rx {
22

33
export interface VirtualTimeScheduler<TAbsolute, TRelative> extends IScheduler {
4+
clock: TAbsolute;
45
/**
56
* Adds a relative time value to an absolute time value.
67
* @param {Number} absolute Absolute virtual time value.
@@ -58,8 +59,31 @@ declare module Rx {
5859
* @returns {ScheduledItem} The next scheduled item.
5960
*/
6061
getNext(): internals.ScheduledItem<TAbsolute>;
62+
63+
/**
64+
* Schedules an action to be executed at dueTime.
65+
* @param {Mixed} state State passed to the action to be executed.
66+
* @param {Any} dueTime Absolute time at which to execute the action.
67+
* @param {Function} action Action to be executed.
68+
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
69+
*/
70+
scheduleAbsolute(
71+
state: any,
72+
dueTime: TAbsolute,
73+
action: (scheduler: VirtualTimeScheduler<TAbsolute, TRelative>, state: any) => any
74+
): SingleAssignmentDisposable;
6175
}
6276

77+
export var VirtualTimeScheduler: {
78+
/**
79+
* Creates a new historical scheduler with the specified initial clock value.
80+
* @constructor
81+
* @param {Any} initialClock Initial value for the clock.
82+
* @param {Function} comparer Comparer to determine causality of events based on absolute time.
83+
*/
84+
new <TAbsolute, TRelative>(initialClock: TAbsolute, comparer: _Comparer<TAbsolute, TRelative>): VirtualTimeScheduler<TAbsolute, TRelative>;
85+
};
86+
6387
export interface HistoricalScheduler extends VirtualTimeScheduler<number, number> {
6488
}
6589

0 commit comments

Comments
 (0)