@powfix/core-js 0.11.9 → 0.11.10
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.
|
@@ -28,7 +28,7 @@ export declare class TimeService {
|
|
|
28
28
|
getClientTime(defaultValue?: TimeService.TimeStamp): TimeService.TimeStamp;
|
|
29
29
|
getServerTime(): TimeService.TimeStamp | null;
|
|
30
30
|
getTime(): number;
|
|
31
|
-
private
|
|
31
|
+
private fetchServerNTPResult;
|
|
32
32
|
getStatus(): TimeServiceStatus;
|
|
33
33
|
start(): void;
|
|
34
34
|
stop(): void;
|
|
@@ -32,17 +32,6 @@ class TimeService {
|
|
|
32
32
|
this.on = this.emitter.on.bind(this.emitter);
|
|
33
33
|
this.off = this.emitter.off.bind(this.emitter);
|
|
34
34
|
this.emit = this.emitter.emit.bind(this.emitter);
|
|
35
|
-
this.fetchServerNTPResult = (t1) => __awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
try {
|
|
37
|
-
if (typeof this.option.serverTimeProvider === 'function') {
|
|
38
|
-
return yield this.option.serverTimeProvider(t1);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
catch (e) {
|
|
42
|
-
console.error(e);
|
|
43
|
-
}
|
|
44
|
-
return null;
|
|
45
|
-
});
|
|
46
35
|
this.option = option;
|
|
47
36
|
if (option.autoStart) {
|
|
48
37
|
this.start();
|
|
@@ -119,6 +108,19 @@ class TimeService {
|
|
|
119
108
|
getTime() {
|
|
120
109
|
return this.getServerTime() || this.getClientTime();
|
|
121
110
|
}
|
|
111
|
+
fetchServerNTPResult(t1) {
|
|
112
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
try {
|
|
114
|
+
if (typeof this.option.serverTimeProvider === 'function') {
|
|
115
|
+
return yield this.option.serverTimeProvider(t1);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
catch (e) {
|
|
119
|
+
console.error(e);
|
|
120
|
+
}
|
|
121
|
+
return null;
|
|
122
|
+
});
|
|
123
|
+
}
|
|
122
124
|
getStatus() {
|
|
123
125
|
return this.status;
|
|
124
126
|
}
|