PrecacheRoute.d.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233
  1. import { Route } from 'workbox-routing/Route.js';
  2. import { PrecacheRouteOptions } from './_types.js';
  3. import { PrecacheController } from './PrecacheController.js';
  4. import './_version.js';
  5. /**
  6. * A subclass of {@link workbox-routing.Route} that takes a
  7. * {@link workbox-precaching.PrecacheController}
  8. * instance and uses it to match incoming requests and handle fetching
  9. * responses from the precache.
  10. *
  11. * @memberof workbox-precaching
  12. * @extends workbox-routing.Route
  13. */
  14. declare class PrecacheRoute extends Route {
  15. /**
  16. * @param {PrecacheController} precacheController A `PrecacheController`
  17. * instance used to both match requests and respond to fetch events.
  18. * @param {Object} [options] Options to control how requests are matched
  19. * against the list of precached URLs.
  20. * @param {string} [options.directoryIndex=index.html] The `directoryIndex` will
  21. * check cache entries for a URLs ending with '/' to see if there is a hit when
  22. * appending the `directoryIndex` value.
  23. * @param {Array<RegExp>} [options.ignoreURLParametersMatching=[/^utm_/, /^fbclid$/]] An
  24. * array of regex's to remove search params when looking for a cache match.
  25. * @param {boolean} [options.cleanURLs=true] The `cleanURLs` option will
  26. * check the cache for the URL with a `.html` added to the end of the end.
  27. * @param {workbox-precaching~urlManipulation} [options.urlManipulation]
  28. * This is a function that should take a URL and return an array of
  29. * alternative URLs that should be checked for precache matches.
  30. */
  31. constructor(precacheController: PrecacheController, options?: PrecacheRouteOptions);
  32. }
  33. export { PrecacheRoute };