@dra2020/baseclient 1.0.165 → 1.0.166
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/dist/baseclient.js +10 -7
- package/dist/baseclient.js.map +1 -1
- package/lib/ot-js/otclientengine.ts +10 -7
- package/package.json +1 -1
|
@@ -34,13 +34,12 @@ export class OTClientEngine extends OTE.OTEngine
|
|
|
34
34
|
this.clientID = cid;
|
|
35
35
|
this.initialize();
|
|
36
36
|
this.bReadOnly = false;
|
|
37
|
-
this.valCache = {};
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
initialize(): void
|
|
41
40
|
{
|
|
42
41
|
if (this.prefailCache === undefined && this.clientSequenceNo > 0)
|
|
43
|
-
this.prefailCache = this.
|
|
42
|
+
this.prefailCache = this.toValue();
|
|
44
43
|
this.clientSequenceNo = 0;
|
|
45
44
|
this.isNeedAck = false;
|
|
46
45
|
this.isNeedResend = false;
|
|
@@ -71,11 +70,15 @@ export class OTClientEngine extends OTE.OTEngine
|
|
|
71
70
|
|
|
72
71
|
toPartialValue(resourceName: string): any
|
|
73
72
|
{
|
|
73
|
+
if (! this.valCache)
|
|
74
|
+
this.valCache = {};
|
|
74
75
|
return this.valCache[resourceName];
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
toValue(): any
|
|
78
79
|
{
|
|
80
|
+
if (! this.valCache)
|
|
81
|
+
this.valCache = this.stateLocal.toValue();
|
|
79
82
|
return this.valCache;
|
|
80
83
|
}
|
|
81
84
|
|
|
@@ -155,7 +158,7 @@ export class OTClientEngine extends OTE.OTEngine
|
|
|
155
158
|
{
|
|
156
159
|
console.log('otclientengine: failbackToInitialState');
|
|
157
160
|
if (this.prefailCache === undefined)
|
|
158
|
-
this.prefailCache = this.
|
|
161
|
+
this.prefailCache = this.toValue();
|
|
159
162
|
this.initialize();
|
|
160
163
|
}
|
|
161
164
|
|
|
@@ -164,7 +167,7 @@ export class OTClientEngine extends OTE.OTEngine
|
|
|
164
167
|
{
|
|
165
168
|
console.log('otclientengine: failbackToServerState');
|
|
166
169
|
if (this.prefailCache === undefined)
|
|
167
|
-
this.prefailCache = this.
|
|
170
|
+
this.prefailCache = this.toValue();
|
|
168
171
|
this.stateLocal = this.stateServer.copy();
|
|
169
172
|
this.isNeedAck = false;
|
|
170
173
|
this.actionSentClient.empty();
|
|
@@ -172,7 +175,7 @@ export class OTClientEngine extends OTE.OTEngine
|
|
|
172
175
|
this.actionServerInterposedSentClient.empty();
|
|
173
176
|
this.actionAllPendingClient.empty();
|
|
174
177
|
this.actionAllClient.empty();
|
|
175
|
-
this.valCache
|
|
178
|
+
delete this.valCache;
|
|
176
179
|
this.emit('state');
|
|
177
180
|
}
|
|
178
181
|
|
|
@@ -284,7 +287,7 @@ export class OTClientEngine extends OTE.OTEngine
|
|
|
284
287
|
this.actionServerInterposedSentClient.compose(orig);
|
|
285
288
|
|
|
286
289
|
// Let clients know
|
|
287
|
-
this.valCache
|
|
290
|
+
delete this.valCache;
|
|
288
291
|
this.emit('state');
|
|
289
292
|
}
|
|
290
293
|
}
|
|
@@ -318,7 +321,7 @@ export class OTClientEngine extends OTE.OTEngine
|
|
|
318
321
|
this.actionAllClient.compose(orig);
|
|
319
322
|
this.actionAllPendingClient.compose(orig);
|
|
320
323
|
this.stateLocal.compose(orig);
|
|
321
|
-
this.valCache
|
|
324
|
+
delete this.valCache;
|
|
322
325
|
this.emit('state');
|
|
323
326
|
}
|
|
324
327
|
catch (err)
|