Skip to content

Commit

Permalink
fix: getGlobal directly return if property exists
Browse files Browse the repository at this point in the history
  • Loading branch information
windingwind committed Nov 17, 2024
1 parent b360236 commit 3b44441
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 3b44441

Please sign in to comment.