precacheAndRoute.js 925 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 { addRoute } from './addRoute.js';
  8. import { precache } from './precache.js';
  9. import './_version.js';
  10. /**
  11. * This method will add entries to the precache list and add a route to
  12. * respond to fetch events.
  13. *
  14. * This is a convenience method that will call
  15. * [precache()]{@link module:workbox-precaching.precache} and
  16. * [addRoute()]{@link module:workbox-precaching.addRoute} in a single call.
  17. *
  18. * @param {Array<Object|string>} entries Array of entries to precache.
  19. * @param {Object} [options] See
  20. * [addRoute() options]{@link module:workbox-precaching.addRoute}.
  21. *
  22. * @memberof module:workbox-precaching
  23. */
  24. function precacheAndRoute(entries, options) {
  25. precache(entries);
  26. addRoute(options);
  27. }
  28. export { precacheAndRoute };