telefunc
Version:
Remote functions. Instead of API.
9 lines (8 loc) • 400 B
JavaScript
export function getGlobalObject(
// We use the filename as key; each `getGlobalObject()` call should live inside a file with a unique filename.
key, defaultValue) {
const globalObjectsAll = (globalThis[projectKey] = globalThis[projectKey] || {});
const globalObject = (globalObjectsAll[key] = globalObjectsAll[key] || defaultValue);
return globalObject;
}
const projectKey = '_telefunc';