@buenos-nachos/time-sync 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/src/TimeSync.ts +18 -17
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/TimeSync.ts
CHANGED
|
@@ -30,7 +30,8 @@ export const refreshRates = Object.freeze({
|
|
|
30
30
|
export interface Configuration {
|
|
31
31
|
/**
|
|
32
32
|
* Indicates whether the TimeSync instance should be frozen for Snapshot
|
|
33
|
-
* tests.
|
|
33
|
+
* tests. Highly encouraged that you use this together with
|
|
34
|
+
* `initialDate`.
|
|
34
35
|
*
|
|
35
36
|
* Defaults to false.
|
|
36
37
|
*/
|
|
@@ -44,7 +45,7 @@ export interface Configuration {
|
|
|
44
45
|
* subscription, this minimum will be used instead.
|
|
45
46
|
*
|
|
46
47
|
* It is highly recommended that you only modify this value if you have a
|
|
47
|
-
* good reason. Updating this value to be too low
|
|
48
|
+
* good reason. Updating this value to be too low can make the event loop
|
|
48
49
|
* get really hot and really tank performance elsewhere in an application.
|
|
49
50
|
*
|
|
50
51
|
* Defaults to 200ms.
|
|
@@ -55,9 +56,11 @@ export interface Configuration {
|
|
|
55
56
|
* Indicates whether the same `onUpdate` callback (by reference) should be
|
|
56
57
|
* called multiple time if registered by multiple systems.
|
|
57
58
|
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
59
|
+
* If this value is flipped to false, each onUpdate callback will receive
|
|
60
|
+
* the subscription context for the FIRST subscriber that registered the
|
|
61
|
+
* onUpdate callback.
|
|
62
|
+
*
|
|
63
|
+
* Defaults to true.
|
|
61
64
|
*/
|
|
62
65
|
readonly allowDuplicateOnUpdateCalls: boolean;
|
|
63
66
|
}
|
|
@@ -66,16 +69,6 @@ export interface Configuration {
|
|
|
66
69
|
* The set of options that can be used to instantiate a TimeSync.
|
|
67
70
|
*/
|
|
68
71
|
export interface InitOptions extends Configuration {
|
|
69
|
-
/**
|
|
70
|
-
* Indicates whether the TimeSync instance should be frozen for snapshot
|
|
71
|
-
* tests. Highly encouraged that you use this together with
|
|
72
|
-
* `initialDate`.
|
|
73
|
-
*
|
|
74
|
-
* Defaults to false.
|
|
75
|
-
*/
|
|
76
|
-
// Duplicated property to override the LSP comment
|
|
77
|
-
readonly freezeUpdates: boolean;
|
|
78
|
-
|
|
79
72
|
/**
|
|
80
73
|
* The Date object to use when initializing TimeSync to make the
|
|
81
74
|
* constructor more pure and deterministic.
|
|
@@ -203,8 +196,16 @@ interface TimeSyncApi {
|
|
|
203
196
|
* intervals. Depending on how TimeSync is instantiated, it may choose to
|
|
204
197
|
* de-duplicate these function calls on each round of updates.
|
|
205
198
|
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
199
|
+
* If a value of Number.POSITIVE_INFINITY is used, the subscription will be
|
|
200
|
+
* considered "idle". Idle subscriptions cannot trigger updates on their
|
|
201
|
+
* own, but can stay in the loop as otherupdates get dispatched from via
|
|
202
|
+
* other subscriptions.
|
|
203
|
+
*
|
|
204
|
+
* Consider using the refreshRates object from this package for a set of
|
|
205
|
+
* commonly-used intervals.
|
|
206
|
+
*
|
|
207
|
+
* @throws {RangeError} If the provided interval is neither a positive
|
|
208
|
+
* integer nor positive infinity.
|
|
208
209
|
* @returns An unsubscribe callback. Calling the callback more than once
|
|
209
210
|
* results in a no-op.
|
|
210
211
|
*/
|