aboutsummaryrefslogtreecommitdiff
path: root/src/client/DocServer.ts
diff options
context:
space:
mode:
authorJames Hu <51237606+jameshu111@users.noreply.github.com>2023-05-04 10:36:59 -0400
committerJames Hu <51237606+jameshu111@users.noreply.github.com>2023-05-04 10:36:59 -0400
commit725bf38dc018cb218d8a88605234e95a2beee446 (patch)
tree9150905cf1b67b06c03fdd8d10ac6da6e8246832 /src/client/DocServer.ts
parent96465f2dccc974a821fa912c90def988b76808e5 (diff)
parent1c24114bbe8f69f61948f7531277305457926498 (diff)
Merge branch 'master' into james-server-stats
Diffstat (limited to 'src/client/DocServer.ts')
-rw-r--r--src/client/DocServer.ts7
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[] = [];