You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

serviceworker.js 355B

12345678910111213141516
  1. import {registerRoute} from 'workbox-routing';
  2. import {StaleWhileRevalidate} from 'workbox-strategies';
  3. const cacheName = 'static-cache-v2';
  4. const cachedDestinations = new Set([
  5. 'manifest',
  6. 'script',
  7. 'style',
  8. 'worker',
  9. ]);
  10. registerRoute(
  11. ({request}) => cachedDestinations.has(request.destination),
  12. new StaleWhileRevalidate({cacheName}),
  13. );