/** * A map for items that are retrieved asynchronously. * * Its purpose is to avoid retrieving values multiple times in asynchronous settings. */ export declare class WaitMap extends Map { private _promises; /** * Creates a promise for the given key. * * @param key The key to create a promise for. */ promise(key: K): void; /** * Returns a boolean indicating whether the given key is in the map or a promise for the key exists. * * @param key The key to check for. */ has(key: K): boolean; /** * Sets the value for the given key and resolves the promise for the key if it exists. * * @param key The key to set the value for. * @param value The value to set. */ set(key: K, value: T): this; /** * Returns a promise that either resolves with the value for the given key or waits for it to be set. * If the value is already set, the promise resolves immediately. * If the value is not set, the promise resolves when the value is set, provided that the promise has been created. * * @param key The key to get the value for. */ getOrWait(key: K): Promise; }