feat: add SproutWorkCollect apps

This commit is contained in:
2026-03-13 17:14:37 +08:00
parent 189baa3d59
commit 46afd3149f
54 changed files with 28126 additions and 4 deletions

View File

@@ -0,0 +1,16 @@
// 在浏览器加载完成后注册自定义 Service Worker使应用成为 PWA。
// 生产环境和开发环境都可以注册,方便本地调试。
export function registerServiceWorker() {
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker
.register('/service-worker.js')
.catch((error) => {
// eslint-disable-next-line no-console
console.error('[PWA] Service Worker 注册失败:', error);
});
});
}
}