mirror of
https://github.com/go-gitea/gitea.git
synced 2024-11-19 02:34:28 +01:00
17 lines
355 B
JavaScript
17 lines
355 B
JavaScript
|
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}),
|
||
|
);
|