Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

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. );