mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-20 14:37:43 +01:00
less PWA logs + allow main indexjs to be cached
This commit is contained in:
parent
bcb2e02b85
commit
e7d6f4559e
2 changed files with 1 additions and 4 deletions
|
@ -1,4 +1,3 @@
|
|||
/* eslint-disable no-console */
|
||||
import { registerSW } from "virtual:pwa-register";
|
||||
|
||||
const intervalMS = 60 * 60 * 1000;
|
||||
|
@ -6,10 +5,8 @@ const intervalMS = 60 * 60 * 1000;
|
|||
registerSW({
|
||||
immediate: true,
|
||||
onRegisteredSW(swUrl, r) {
|
||||
console.log(`SW registered at: ${swUrl}`);
|
||||
if (!r) return;
|
||||
setInterval(async () => {
|
||||
console.log(`attempting SW update`);
|
||||
if (!(!r.installing && navigator)) return;
|
||||
|
||||
if ("connection" in navigator && !navigator.onLine) return;
|
||||
|
@ -23,7 +20,6 @@ registerSW({
|
|||
});
|
||||
|
||||
if (resp?.status === 200) {
|
||||
console.log(`SW update successfully triggered`);
|
||||
await r.update();
|
||||
}
|
||||
}, intervalMS);
|
||||
|
|
|
@ -42,6 +42,7 @@ export default defineConfig(({ mode }) => {
|
|||
disable: process.env.VITE_PWA_ENABLED !== "yes",
|
||||
registerType: "autoUpdate",
|
||||
workbox: {
|
||||
maximumFileSizeToCacheInBytes: 4000000, // 4mb
|
||||
globIgnores: ["**ping.txt**"]
|
||||
},
|
||||
includeAssets: [
|
||||
|
|
Loading…
Reference in a new issue