Fixes issues with global.
This commit is contained in:
11
data-extraction/src/getGlobal.ts
Normal file
11
data-extraction/src/getGlobal.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export function getGlobal(): any {
|
||||
if (typeof globalThis === "object") {
|
||||
return globalThis;
|
||||
} else if (typeof global === "object") {
|
||||
return global;
|
||||
} else if (typeof window === "object") {
|
||||
return window;
|
||||
}
|
||||
|
||||
throw new Error("No global available");
|
||||
}
|
||||
Reference in New Issue
Block a user