mirror of
https://github.com/typeorm/typeorm.git
synced 2025-12-08 21:26:23 +00:00
fix(platform[web worker]): improve globalThis variable retrieval for browser environment (#11495)
This commit is contained in:
parent
6e9f20d4d9
commit
ec26eae824
@ -20,10 +20,12 @@ export class PlatformTools {
|
||||
static getGlobalVariable(): any {
|
||||
if (typeof window !== "undefined") {
|
||||
return window
|
||||
} else {
|
||||
// NativeScript uses global, not window
|
||||
return global
|
||||
}
|
||||
if (typeof globalThis !== "undefined") {
|
||||
return globalThis
|
||||
}
|
||||
// NativeScript uses global, not window
|
||||
return global
|
||||
}
|
||||
|
||||
/**
|
||||
@ -162,6 +164,9 @@ declare var window: Window;
|
||||
if (typeof window !== "undefined") {
|
||||
window.Buffer = Buffer;
|
||||
}
|
||||
if (typeof globalThis !== "undefined") {
|
||||
globalThis.Buffer = Buffer;
|
||||
}
|
||||
// NativeScript uses global, not window
|
||||
if (typeof global !== "undefined" && typeof require !== "undefined") {
|
||||
global.Buffer = require("buffer/").Buffer;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user