import { DIVEResourceCache } from './cache/ResourceCache.ts'; /** * What a DIVE object holds of something loaded by URL: a lease on the * resource prototype of that URL, and the load on its way. * * Prototypes are shared by URL, so the same URL used in several places is * loaded once. The lease is released once it is replaced, cleared or * disposed. Of overlapping requests the last one wins, and a lease drawn for * a request that was overtaken is released on arrival. * * Holding a value puts it nowhere: a user compares it with what three * renders from and assigns it there itself, right before rendering. * * @typeParam T - The value, e.g. a texture. */ export declare class DIVEResource { private _cache; private _url; private _lease; /** the load serving the newest request; replacing it makes it stale */ private _pending; private _disposed; /** * @param _cache - Where the prototypes are kept. */ constructor(_cache: DIVEResourceCache); /** The URL of the value in place, `null` for none. */ get url(): string | null; /** The value in place, `null` for none. */ get value(): T | null; /** * Puts the value of a URL in place once it has loaded. * * @param url - The URL. * @returns Resolves once the value is in place or was overtaken. */ request(url: string): Promise; /** Drops the value in place and any load on its way. */ clear(): void; /** Releases the lease in place; a load still on its way releases its own. */ dispose(): void; private _load; private _set; }