diff options
author | bobzel <zzzman@gmail.com> | 2023-04-27 22:56:56 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2023-04-27 22:56:56 -0400 |
commit | c27fcf300d72248e82d722e1b7ded9e0ca07f657 (patch) | |
tree | e6c99b49324c60713b59c65c8963b018f59dc1ec /src/client/DocServer.ts | |
parent | d3dc9938b38e89b2215d13fbc5bc92d33502e818 (diff) | |
parent | 66e5fe4d8c4c6fae768305e31b45735f563b7500 (diff) |
merged with master
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[] = []; |