Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* global __PRECACHE_MANIFEST__ */
import {PrecacheController} from 'workbox-precaching/PrecacheController.mjs';
import {Route} from 'workbox-routing/Route.mjs';
import {CacheFirst} from 'workbox-strategies/CacheFirst.mjs';
import {cacheNames} from './caches.js';
const pc = new PrecacheController(cacheNames.SHELL);
const precacheMatcher = ({url}) => {
return Boolean(pc.getCacheKeyForURL(url.href));
};
const cacheFirst = new CacheFirst({cacheName: cacheNames.SHELL});
export const precacheHandler = ({request, event}) => {
const cacheKey = pc.getCacheKeyForURL(request.url);
return cacheFirst.handle({
request: new Request(cacheKey),
event,
});
};