@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
package/dist/baseclient.js
CHANGED
|
@@ -5274,11 +5274,10 @@ class OTClientEngine extends OTE.OTEngine {
|
|
|
5274
5274
|
this.clientID = cid;
|
|
5275
5275
|
this.initialize();
|
|
5276
5276
|
this.bReadOnly = false;
|
|
5277
|
-
this.valCache = {};
|
|
5278
5277
|
}
|
|
5279
5278
|
initialize() {
|
|
5280
5279
|
if (this.prefailCache === undefined && this.clientSequenceNo > 0)
|
|
5281
|
-
this.prefailCache = this.
|
|
5280
|
+
this.prefailCache = this.toValue();
|
|
5282
5281
|
this.clientSequenceNo = 0;
|
|
5283
5282
|
this.isNeedAck = false;
|
|
5284
5283
|
this.isNeedResend = false;
|
|
@@ -5301,9 +5300,13 @@ class OTClientEngine extends OTE.OTEngine {
|
|
|
5301
5300
|
return this.resourceID;
|
|
5302
5301
|
}
|
|
5303
5302
|
toPartialValue(resourceName) {
|
|
5303
|
+
if (!this.valCache)
|
|
5304
|
+
this.valCache = {};
|
|
5304
5305
|
return this.valCache[resourceName];
|
|
5305
5306
|
}
|
|
5306
5307
|
toValue() {
|
|
5308
|
+
if (!this.valCache)
|
|
5309
|
+
this.valCache = this.stateLocal.toValue();
|
|
5307
5310
|
return this.valCache;
|
|
5308
5311
|
}
|
|
5309
5312
|
toPrefailValue() {
|
|
@@ -5363,14 +5366,14 @@ class OTClientEngine extends OTE.OTEngine {
|
|
|
5363
5366
|
failbackToInitialState() {
|
|
5364
5367
|
console.log('otclientengine: failbackToInitialState');
|
|
5365
5368
|
if (this.prefailCache === undefined)
|
|
5366
|
-
this.prefailCache = this.
|
|
5369
|
+
this.prefailCache = this.toValue();
|
|
5367
5370
|
this.initialize();
|
|
5368
5371
|
}
|
|
5369
5372
|
// When I have server state but my state got mixed up
|
|
5370
5373
|
failbackToServerState() {
|
|
5371
5374
|
console.log('otclientengine: failbackToServerState');
|
|
5372
5375
|
if (this.prefailCache === undefined)
|
|
5373
|
-
this.prefailCache = this.
|
|
5376
|
+
this.prefailCache = this.toValue();
|
|
5374
5377
|
this.stateLocal = this.stateServer.copy();
|
|
5375
5378
|
this.isNeedAck = false;
|
|
5376
5379
|
this.actionSentClient.empty();
|
|
@@ -5378,7 +5381,7 @@ class OTClientEngine extends OTE.OTEngine {
|
|
|
5378
5381
|
this.actionServerInterposedSentClient.empty();
|
|
5379
5382
|
this.actionAllPendingClient.empty();
|
|
5380
5383
|
this.actionAllClient.empty();
|
|
5381
|
-
this.valCache
|
|
5384
|
+
delete this.valCache;
|
|
5382
5385
|
this.emit('state');
|
|
5383
5386
|
}
|
|
5384
5387
|
//
|
|
@@ -5464,7 +5467,7 @@ class OTClientEngine extends OTE.OTEngine {
|
|
|
5464
5467
|
if (this.isNeedAck)
|
|
5465
5468
|
this.actionServerInterposedSentClient.compose(orig);
|
|
5466
5469
|
// Let clients know
|
|
5467
|
-
this.valCache
|
|
5470
|
+
delete this.valCache;
|
|
5468
5471
|
this.emit('state');
|
|
5469
5472
|
}
|
|
5470
5473
|
}
|
|
@@ -5494,7 +5497,7 @@ class OTClientEngine extends OTE.OTEngine {
|
|
|
5494
5497
|
this.actionAllClient.compose(orig);
|
|
5495
5498
|
this.actionAllPendingClient.compose(orig);
|
|
5496
5499
|
this.stateLocal.compose(orig);
|
|
5497
|
-
this.valCache
|
|
5500
|
+
delete this.valCache;
|
|
5498
5501
|
this.emit('state');
|
|
5499
5502
|
}
|
|
5500
5503
|
catch (err) {
|