@dcl/ecs
Version:
Decentraland ECS
24 lines (23 loc) • 583 B
JavaScript
;
/**
* Internal utilities for standardized globalThis access.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.setGlobalPolyfill = exports.getGlobal = void 0;
/**
* Type-safe globalThis property access.
* @internal
*/
function getGlobal(key) {
return globalThis[key];
}
exports.getGlobal = getGlobal;
/**
* Sets a globalThis property as a polyfill (only if undefined/null).
* @internal
*/
function setGlobalPolyfill(key, value) {
;
globalThis[key] = globalThis[key] ?? value;
}
exports.setGlobalPolyfill = setGlobalPolyfill;