aboutsummaryrefslogtreecommitdiff
path: root/src/client/DocServer.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/DocServer.ts')
-rw-r--r--src/client/DocServer.ts15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/client/DocServer.ts b/src/client/DocServer.ts
index b833d3287..cf7a61d24 100644
--- a/src/client/DocServer.ts
+++ b/src/client/DocServer.ts
@@ -8,7 +8,7 @@ import { FieldLoader } from '../fields/FieldLoader';
import { HandleUpdate, Id, Parent } from '../fields/FieldSymbols';
import { ObjectField, SetObjGetRefField, SetObjGetRefFields } from '../fields/ObjectField';
import { RefField } from '../fields/RefField';
-import { GestureContent, Message, MessageStore, MobileDocumentUploadContent, MobileInkOverlayContent, UpdateMobileInkOverlayPositionContent, YoutubeQueryTypes } from './../server/Message';
+import { GestureContent, Message, MessageStore, MobileDocumentUploadContent, MobileInkOverlayContent, UpdateMobileInkOverlayPositionContent, YoutubeQueryTypes } from '../server/Message';
import { SerializationHelper } from './util/SerializationHelper';
/**
@@ -63,7 +63,7 @@ export namespace DocServer {
return foundDocId ? (_cache[foundDocId] as Doc) : undefined;
}
- export let _socket: Socket;
+ let _socket: Socket;
// this client's distinct GUID created at initialization
let USER_ID: string;
// indicates whether or not a document is currently being udpated, and, if so, its id
@@ -317,7 +317,7 @@ export namespace DocServer {
// ii) which are already in the process of being fetched
// iii) which already exist in the cache
// eslint-disable-next-line no-restricted-syntax
- for (const id of ids.filter(id => id)) {
+ for (const id of ids.filter(filterid => filterid)) {
const cached = _cache[id];
if (cached === undefined) {
defaultPromises.push({
@@ -362,6 +362,7 @@ export namespace DocServer {
for (const field of serializedFields) {
processed++;
if (processed % 150 === 0) {
+ // eslint-disable-next-line no-loop-func
runInAction(() => {
FieldLoader.ServerLoadStatus.retrieved = processed;
});
@@ -375,6 +376,7 @@ export namespace DocServer {
// deserialize
// adds to a list of promises that will be awaited asynchronously
promises.push(
+ // eslint-disable-next-line no-loop-func
(_cache[field.id] = SerializationHelper.Deserialize(field).then(deserialized => {
// overwrite or delete any promises (that we inserted as flags
// to indicate that the field was in the process of being fetched). Now everything
@@ -447,7 +449,10 @@ export namespace DocServer {
}
// WRITE A NEW DOCUMENT TO THE SERVER
- export let CacheNeedsUpdate = false;
+ let _cacheNeedsUpdate = false;
+ export function CacheNeedsUpdate() {
+ return _cacheNeedsUpdate;
+ }
/**
* A wrapper around the function local variable _createField.
@@ -456,7 +461,7 @@ export namespace DocServer {
* @param field the [RefField] to be serialized and sent to the server to be stored in the database
*/
export function CreateField(field: RefField) {
- CacheNeedsUpdate = true;
+ _cacheNeedsUpdate = true;
_CreateField(field);
}