matchPrecache.js 976 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. Copyright 2019 Google LLC
  3. Use of this source code is governed by an MIT-style
  4. license that can be found in the LICENSE file or at
  5. https://opensource.org/licenses/MIT.
  6. */
  7. import { getOrCreatePrecacheController } from './utils/getOrCreatePrecacheController.js';
  8. import './_version.js';
  9. /**
  10. * Helper function that calls
  11. * {@link PrecacheController#matchPrecache} on the default
  12. * {@link PrecacheController} instance.
  13. *
  14. * If you are creating your own {@link PrecacheController}, then call
  15. * {@link PrecacheController#matchPrecache} on that instance,
  16. * instead of using this function.
  17. *
  18. * @param {string|Request} request The key (without revisioning parameters)
  19. * to look up in the precache.
  20. * @return {Promise<Response|undefined>}
  21. *
  22. * @memberof module:workbox-precaching
  23. */
  24. function matchPrecache(request) {
  25. const precacheController = getOrCreatePrecacheController();
  26. return precacheController.matchPrecache(request);
  27. }
  28. export { matchPrecache };