import { FetchableTile } from './FetchableTile.js'; import { FetchFn } from '@allmaps/types'; import { WarpedMapWithImage } from '../maps/WarpedMap.js'; import { MapPruneConstants, MapPruneInfo, SpritesInfo } from '../shared/types.js'; /** * Class for tiles that can be cached. */ export declare abstract class CacheableTile extends EventTarget { readonly fetchableTile: FetchableTile; readonly fetchFn?: FetchFn; protected abortController: AbortController; protected data?: D; protected cachedTilesFromSprites?: CachedTile[]; /** * Creates an instance of CacheableTile. * * Note that there can be multiple FetchableTiles with the same tileUrl, but only one CachedTile per tileUrl. * * @constructor * @param fetchableTile - The FetchableTile which created this CachedTile. * @param fetchFn - Optional fetch function to use */ constructor(fetchableTile: FetchableTile, fetchFn?: FetchFn); abstract fetch(): Promise; abstract applySprites(): Promise; abstract spritesDataToCachedTiles(clippedImageDatas: ImageData[], spritesInfo: SpritesInfo, warpedMapsByResourceId: Map): CachedTile[]; /** * Whether a tile has fetched its data * * @returns */ isCachedTile(): this is CachedTile; isTileFromSprites(): boolean; getCachedTilesFromSprites(): CachedTile[] | undefined; /** * Abort the fetch */ abort(): void; shouldPrune(mapPruneInfo: MapPruneInfo | undefined, mapPruneConstants: MapPruneConstants): boolean; } /** * Class for tiles that are cached, i.e. their data has been fetched and processed */ export declare abstract class CachedTile extends CacheableTile { data: D; }