Use globalThis.
It's designed to solve exactly this problem, and has been universally available since 2020. The most likely scenario for `globalThis` to fail is if the user is stuck with an old browser, in which case `self` will be available. `window` will be too, but `self` also works in web workers.
This commit is contained in:
@@ -35,8 +35,8 @@
|
||||
define.__amd = define.amd;
|
||||
define.amd = null;
|
||||
}
|
||||
})(typeof exports !== "undefined" ? exports : typeof define === "function" && define.amd ? {} : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : this,
|
||||
typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : this);
|
||||
})(typeof exports !== "undefined" ? exports : typeof define === "function" && define.amd ? {} : typeof globalThis !== "undefined" ? globalThis : self,
|
||||
typeof globalThis !== "undefined" ? globalThis : self);
|
||||
|
||||
::if embeddedLibraries::::foreach embeddedLibraries::
|
||||
::__current__::::end::::end::
|
||||
|
||||
Reference in New Issue
Block a user