/** * @copyright Sister Software * @license AGPL-3.0 * @author Teffen Ellis, et al. */ /** * A resource that can be disposed of either synchronously or asynchronously. */ export type DisposableLike = Disposable | AsyncDisposable; export type ResourceConstructor = new (key: K) => R; export type ResourceFactory = (key: K) => R | Promise; export type ResourceFactoryLike = ResourceConstructor | ResourceFactory; export type InferResource = F extends ResourceConstructor ? R : F extends ResourceFactory ? R : never; export type OpenResourceResult = F extends ResourceConstructor ? R : F extends ResourceFactory ? ReturnType : never; /** * Type-guard to determine if a value is a promise-like object. */ export declare function isPromiseLike(value: unknown): value is PromiseLike; /** * A map-like object that caches disposable resources, creating them on demand. */ export declare class ResourceMapCache = ResourceConstructor> extends Map implements AsyncDisposable { /** * The human-readable name of the resource. */ displayName: string; protected readonly factoryLike: F; constructor(ResourceConstructor: ResourceConstructor); constructor(factory: ResourceFactory); /** * Gets a resource from the cache, creating if it doesn't exist. */ open(key: K): OpenResourceResult; /** * Closes a resource and removes it from the cache. */ close(key: K): void; [Symbol.asyncDispose](): Promise; } //# sourceMappingURL=ResourceMapCache.d.ts.map