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:
Joseph Cloutier
2024-06-10 14:26:46 -04:00
parent 832ac358c1
commit 2874ac9cab

View File

@@ -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::