imageCache.d.ts 1.2 KB

12345678910111213141516171819202122232425
  1. import { RouteMatchCallback, WorkboxPlugin } from 'workbox-core/types.js';
  2. import './_version.js';
  3. export interface ImageCacheOptions {
  4. cacheName?: string;
  5. matchCallback?: RouteMatchCallback;
  6. maxAgeSeconds?: number;
  7. maxEntries?: number;
  8. plugins?: Array<WorkboxPlugin>;
  9. warmCache?: Array<string>;
  10. }
  11. /**
  12. * An implementation of the [image caching recipe]{@link https://developers.google.com/web/tools/workbox/guides/common-recipes#caching_images}
  13. *
  14. * @memberof workbox-recipes
  15. *
  16. * @param {Object} [options]
  17. * @param {string} [options.cacheName] Name for cache. Defaults to images
  18. * @param {RouteMatchCallback} [options.matchCallback] Workbox callback function to call to match to. Defaults to request.destination === 'image';
  19. * @param {number} [options.maxAgeSeconds] Maximum age, in seconds, that font entries will be cached for. Defaults to 30 days
  20. * @param {number} [options.maxEntries] Maximum number of images that will be cached. Defaults to 60
  21. * @param {WorkboxPlugin[]} [options.plugins] Additional plugins to use for this recipe
  22. * @param {string[]} [options.warmCache] Paths to call to use to warm this cache
  23. */
  24. declare function imageCache(options?: ImageCacheOptions): void;
  25. export { imageCache };