diff options
author | bobzel <zzzman@gmail.com> | 2023-05-10 10:08:50 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2023-05-10 10:08:50 -0400 |
commit | ebb846116af9c7e65a9d674c765c71c0bf0a7d29 (patch) | |
tree | d8278e7c27f7577eb5b4706604144940d12a718e /src/client/DocServer.ts | |
parent | f912a233a89c8772b22b71d34830ff4b0ba82310 (diff) | |
parent | 719da9462f02fd3afda9b0b65de19de9405ab4fc (diff) |
Merge branch 'master' into UI_Update_Eric_Ma
Diffstat (limited to 'src/client/DocServer.ts')
-rw-r--r-- | src/client/DocServer.ts | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/client/DocServer.ts b/src/client/DocServer.ts index 8f79ebb03..ba64f993c 100644 --- a/src/client/DocServer.ts +++ b/src/client/DocServer.ts @@ -29,6 +29,13 @@ import { GestureOverlay } from './views/GestureOverlay'; export namespace DocServer { let _cache: { [id: string]: RefField | Promise<Opt<RefField>> } = {}; + export function QUERY_SERVER_CACHE(title: string) { + const foundDocId = Array.from(Object.keys(_cache)) + .filter(key => _cache[key] instanceof Doc) + .find(key => (_cache[key] as Doc).title === title); + + return foundDocId ? (_cache[foundDocId] as Doc) : undefined; + } export function UPDATE_SERVER_CACHE(print: boolean = false) { if (print) { const strings: string[] = []; |