From 3b44441c6523c814b9f3da80008eb60e9f16ed3d Mon Sep 17 00:00:00 2001 From: windingwind <33902321+windingwind@users.noreply.github.com> Date: Sun, 17 Nov 2024 18:13:13 +0100 Subject: [PATCH] fix: getGlobal directly return if property exists --- src/basic.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/basic.ts b/src/basic.ts index 48836f5..a4d44a2 100644 --- a/src/basic.ts +++ b/src/basic.ts @@ -132,6 +132,9 @@ export class BasicTool { */ getGlobal(k: string): any; getGlobal(k: string) { + if (typeof globalThis[k as keyof typeof globalThis] !== "undefined") { + return globalThis[k as keyof typeof globalThis]; + } const _Zotero = BasicTool.getZotero(); try { const window = _Zotero.getMainWindow();