import { ResidueTileOptions } from "../../types/types"; /** * A simple, in-memory cache for Canvas tiles outside of the DOM. * Gets automatically invalidated when called with different widths. * If `maxElements` are exceed, the oldest element (by insertion time) will be * removed from the cache. * * @param {Number} maxElements Maximal elements to keep in the cache (default: 200) */ declare class CanvasCache { private maxElements; private cache; private spec; private cachedElements; constructor({ maxElements }?: { maxElements?: number; }); /** * Creates a canvas element outside of the DOM that can be used for caching. * @param {string} key Unique cache key of the element * @param {Number} tileWidth Width of the to be created canvas * @param {Number} tileWidth Width of the to be created canvas * @param {function} create Callback to be called if for the given `key` to canvas exists in the cache */ createTile({ key, tileWidth, tileHeight, create, }: { key: string; tileWidth: number; tileHeight: number; create: ({ ctx }: { ctx: CanvasRenderingContext2D; }) => void; }): HTMLCanvasElement; /** * Checks whether the tile specification has changed and the cache needs * to be refreshed. * Pass in an object of all the properties that would result in the cache to be refreshed * Like React.PureComponents the passed-in properties are compared by their * shallow equality. * * @param {object} spec Object of all parameters that depend on this cache * Returns: `true` when the cache has been invalidated */ updateTileSpecs(spec: ResidueTileOptions): boolean; /** * Invalidates the entire cache and removed all elements. */ invalidate(): void; } export default CanvasCache; //# sourceMappingURL=CanvasCache.d.ts.map