diff options
author | Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> | 2020-10-18 00:56:36 +0800 |
---|---|---|
committer | Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> | 2020-10-18 00:56:36 +0800 |
commit | dc58a9b7962c7a2e7916345980fe17a745244231 (patch) | |
tree | c2ace02f53ba182c7da1e02a4a3a08f26020d402 /src/client/DocServer.ts | |
parent | 3f5fb2e5dc258312e10698f3223239815959d7b6 (diff) | |
parent | 5816840af60f97a34318a52a5276482cab392496 (diff) |
Merge branch 'presentation_v1' of https://github.com/browngraphicslab/Dash-Web into presentation_v1
Diffstat (limited to 'src/client/DocServer.ts')
-rw-r--r-- | src/client/DocServer.ts | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/client/DocServer.ts b/src/client/DocServer.ts index 00f9877c3..1d7497cf8 100644 --- a/src/client/DocServer.ts +++ b/src/client/DocServer.ts @@ -28,13 +28,13 @@ import * as rp from 'request-promise'; export namespace DocServer { let _cache: { [id: string]: RefField | Promise<Opt<RefField>> } = {}; - export function PRINT_CACHE() { + export function UPDATE_SERVER_CACHE(print: boolean = false) { const strings: string[] = []; Array.from(Object.keys(_cache)).forEach(key => { const doc = _cache[key]; if (doc instanceof Doc) strings.push(StrCast(doc.author) + " " + StrCast(doc.title) + " " + StrCast(Doc.GetT(doc, "title", "string", true))); }); - strings.sort().forEach((str, i) => console.log(i.toString() + " " + str)); + print && strings.sort().forEach((str, i) => console.log(i.toString() + " " + str)); rp.post(Utils.prepend("/setCacheDocumentIds"), { body: { cacheDocumentIds: Array.from(Object.keys(_cache)).join(";"), @@ -348,7 +348,6 @@ export namespace DocServer { } if (requestedIds.length) { - // 2) synchronously, we emit a single callback to the server requesting the serialized (i.e. represented by a string) // fields for the given ids. This returns a promise, which, when resolved, indicates that all the JSON serialized versions of // the fields have been returned from the server |