mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-04-30 12:40:10 +00:00
18 lines
642 B
JavaScript
18 lines
642 B
JavaScript
// src/utils/globals.tsx
|
|
var globalVar = typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {};
|
|
if (typeof globalThis === "undefined") {
|
|
globalVar.globalThis = globalVar;
|
|
}
|
|
var stackGlobalsSymbol = Symbol.for("__stack-globals");
|
|
globalVar[stackGlobalsSymbol] ??= {};
|
|
function createGlobal(key, init) {
|
|
if (!globalVar[stackGlobalsSymbol][key]) {
|
|
globalVar[stackGlobalsSymbol][key] = init();
|
|
}
|
|
return globalVar[stackGlobalsSymbol][key];
|
|
}
|
|
export {
|
|
createGlobal,
|
|
globalVar
|
|
};
|
|
//# sourceMappingURL=globals.js.map
|