@powfix/core-js 0.9.30 → 0.9.32
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.
|
@@ -29,15 +29,21 @@ class TimeService {
|
|
|
29
29
|
this.status = TimeServiceStatus.STOPPED;
|
|
30
30
|
// Emitter
|
|
31
31
|
this.emitter = new eventemitter3_1.default();
|
|
32
|
-
this.on = this.emitter.on;
|
|
33
|
-
this.off = this.emitter.off;
|
|
34
|
-
this.emit = this.emitter.emit;
|
|
32
|
+
this.on = this.emitter.on.bind(this.emitter);
|
|
33
|
+
this.off = this.emitter.off.bind(this.emitter);
|
|
34
|
+
this.emit = this.emitter.emit.bind(this.emitter);
|
|
35
35
|
this.getOption = () => {
|
|
36
36
|
return this.option;
|
|
37
37
|
};
|
|
38
38
|
this.setOption = (option) => {
|
|
39
39
|
return this.option = option;
|
|
40
40
|
};
|
|
41
|
+
this.setSyncedAt = (syncedAt) => {
|
|
42
|
+
this.syncedAt = syncedAt;
|
|
43
|
+
// Emit
|
|
44
|
+
this.emit('SYNCED', syncedAt);
|
|
45
|
+
return syncedAt;
|
|
46
|
+
};
|
|
41
47
|
this.fetchServerNTPResult = (t1) => __awaiter(this, void 0, void 0, function* () {
|
|
42
48
|
try {
|
|
43
49
|
if (typeof this.option.serverTimeProvider === 'function') {
|
|
@@ -127,13 +133,13 @@ class TimeService {
|
|
|
127
133
|
this.start();
|
|
128
134
|
}
|
|
129
135
|
// Binding
|
|
130
|
-
this.emit = this.emit.bind(this);
|
|
131
|
-
this.start = this.start.bind(this);
|
|
132
|
-
this.stop = this.stop.bind(this);
|
|
133
|
-
this.sync = this.sync.bind(this);
|
|
134
|
-
this.getOption = this.getOption.bind(this);
|
|
135
|
-
this.setOption = this.setOption.bind(this);
|
|
136
|
-
this.setSyncedAt = this.setSyncedAt.bind(this);
|
|
136
|
+
// this.emit = this.emit.bind(this);
|
|
137
|
+
// this.start = this.start.bind(this);
|
|
138
|
+
// this.stop = this.stop.bind(this);
|
|
139
|
+
// this.sync = this.sync.bind(this);
|
|
140
|
+
// this.getOption = this.getOption.bind(this);
|
|
141
|
+
// this.setOption = this.setOption.bind(this);
|
|
142
|
+
// this.setSyncedAt = this.setSyncedAt.bind(this);
|
|
137
143
|
}
|
|
138
144
|
getOffset(defaultValue) {
|
|
139
145
|
if (this.offset !== undefined) {
|
|
@@ -150,12 +156,6 @@ class TimeService {
|
|
|
150
156
|
getSyncedAt() {
|
|
151
157
|
return this.syncedAt;
|
|
152
158
|
}
|
|
153
|
-
setSyncedAt(syncedAt) {
|
|
154
|
-
this.syncedAt = syncedAt;
|
|
155
|
-
// Emit
|
|
156
|
-
this.emit('SYNCED', syncedAt);
|
|
157
|
-
return syncedAt;
|
|
158
|
-
}
|
|
159
159
|
getSyncInterval() {
|
|
160
160
|
if (this.option.syncInterval === undefined) {
|
|
161
161
|
// If option is undefined using default value
|