Files
real-time-fund/public/sw.js
2026-03-10 07:34:04 +08:00

19 lines
491 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 最小 Service Worker满足 Android Chrome「添加到主屏幕」的安装条件
const CACHE_NAME = 'jigubao-v1';
self.addEventListener('install', (event) => {
self.skipWaiting();
});
self.addEventListener('activate', (event) => {
event.waitUntil(self.clients.claim());
});
self.addEventListener('fetch', (event) => {
event.respondWith(
fetch(event.request).catch(() => {
return new Response('', { status: 503, statusText: 'Service Unavailable' });
})
);
});