//#region src/util/weak-ref-map.d.ts /** * A map with strong keys and weak values: entries disappear on their own once nothing else * references the value. Useful as an identity map, where the point is to hand back the *same* * instance for a given key while it is still in use, without the map itself being the reason it * stays alive. * * ```ts * const cache = new WeakRefMap(); * cache.add(user.id, user); * cache.get(user.id); // the same instance, until nothing holds it any more * ``` * * Identity therefore lasts exactly as long as someone is holding the value. Once the last * reference goes, a later lookup misses and a fresh instance is built — which is unobservable, * since by definition nothing was holding the old one. */ declare class WeakRefMap { private cacheMap; private finalizer; /** Store `value` under `key`, replacing any existing entry, and return it. */ add(key: K, value: V): V; /** The live value for `key`, or `undefined` if absent or already collected. */ get(key: K): V | undefined; has(key: K): boolean; /** * Drop the entry for `key` immediately rather than waiting for collection. Use when the value * is known to be gone for good — a deleted record, say — so a later lookup builds a fresh * instance instead of reviving the old one. */ delete(key: K): boolean; /** Forget everything. Values held elsewhere stay alive, they are just no longer identity-mapped. */ clear(): void; } //#endregion export { WeakRefMap as t }; //# sourceMappingURL=weak-ref-map-DVc6VbJ3.d.mts.map