test: service worker 总是null

dev/timezone
Lei OT 1 year ago
parent 7393e9c98e
commit 38866690c2

@ -26,7 +26,7 @@ const ClearCache = (props) => {
const clearAllCaches = async () => {
try {
// 1. Clear the service worker cache
if (navigator.serviceWorker.controller) {
if (navigator.serviceWorker) {
const cacheNames = await caches.keys();
await Promise.all(cacheNames.map((name) => caches.delete(name)));
}

@ -24,6 +24,8 @@ const manifestForPlugIn = {
workbox: {
globPatterns: ['**/*.{json,css,js,html,ico,png,svg,woff2}'],
maximumFileSizeToCacheInBytes: 3000000,
clientsClaim: true,
skipWaiting: true,
runtimeCaching: [
{
urlPattern: /^https:\/\/haina-sale-system\.oss-cn-shenzhen\.aliyuncs\.com\/.*/i,

Loading…
Cancel
Save