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.
16 lines
355 B
16 lines
355 B
import {registerRoute} from 'workbox-routing';
|
|
import {StaleWhileRevalidate} from 'workbox-strategies';
|
|
|
|
const cacheName = 'static-cache-v2';
|
|
|
|
const cachedDestinations = new Set([
|
|
'manifest',
|
|
'script',
|
|
'style',
|
|
'worker',
|
|
]);
|
|
|
|
registerRoute(
|
|
({request}) => cachedDestinations.has(request.destination),
|
|
new StaleWhileRevalidate({cacheName}),
|
|
);
|
|
|