addRoute.d.ts 1.4 KB

12345678910111213141516171819202122232425262728
  1. import { FetchListenerOptions } from './utils/addFetchListener.js';
  2. import './_version.js';
  3. /**
  4. * Add a `fetch` listener to the service worker that will
  5. * respond to
  6. * [network requests]{@link https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers#Custom_responses_to_requests}
  7. * with precached assets.
  8. *
  9. * Requests for assets that aren't precached, the `FetchEvent` will not be
  10. * responded to, allowing the event to fall through to other `fetch` event
  11. * listeners.
  12. *
  13. * @param {Object} [options]
  14. * @param {string} [options.directoryIndex=index.html] The `directoryIndex` will
  15. * check cache entries for a URLs ending with '/' to see if there is a hit when
  16. * appending the `directoryIndex` value.
  17. * @param {Array<RegExp>} [options.ignoreURLParametersMatching=[/^utm_/]] An
  18. * array of regex's to remove search params when looking for a cache match.
  19. * @param {boolean} [options.cleanURLs=true] The `cleanURLs` option will
  20. * check the cache for the URL with a `.html` added to the end of the end.
  21. * @param {module:workbox-precaching~urlManipulation} [options.urlManipulation]
  22. * This is a function that should take a URL and return an array of
  23. * alternative URLs that should be checked for precache matches.
  24. *
  25. * @memberof module:workbox-precaching
  26. */
  27. declare function addRoute(options?: FetchListenerOptions): void;
  28. export { addRoute };