// Safe for process-local caches and registries that can tolerate helper-based // resolution. Do not use this for live mutable state that must survive split // runtime chunks; keep those on a direct globalThis[Symbol.for(...)] lookup.
export function resolveGlobalSingleton<T>(key: symbol, create: () => T): T { const globalStore = globalThis as Record<PropertyKey, unknown>; if (Object.prototype.hasOwnProperty.call(globalStore, key)) { return globalStore[key] as T;
} const created = create();
globalStore[key] = created; return created;
}
export function resolveGlobalMap<TKey, TValue>(key: symbol): Map<TKey, TValue> { return resolveGlobalSingleton(key, () => new Map<TKey, TValue>());
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet am 2026-06-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.