fix: fix PWA
This commit is contained in:
@ -7,8 +7,16 @@
|
|||||||
<meta name="theme-color" content="#0f172a" />
|
<meta name="theme-color" content="#0f172a" />
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||||
|
<link rel="manifest" href="/manifest.webmanifest" />
|
||||||
%sveltekit.head%
|
%sveltekit.head%
|
||||||
<script src="/registerSW.js"></script>
|
<script src="/registerSW.js"></script>
|
||||||
|
<script>
|
||||||
|
window.__installPrompt = null;
|
||||||
|
window.addEventListener('beforeinstallprompt', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
window.__installPrompt = e;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body data-sveltekit-preload-data="hover" class="bg-slate-900 text-slate-100">
|
<body data-sveltekit-preload-data="hover" class="bg-slate-900 text-slate-100">
|
||||||
<div style="display: contents">%sveltekit.body%</div>
|
<div style="display: contents">%sveltekit.body%</div>
|
||||||
|
|||||||
@ -123,6 +123,11 @@
|
|||||||
if (evt.type === "containers.updated") load();
|
if (evt.type === "containers.updated") load();
|
||||||
if (evt.type === "agent.connected" || evt.type === "agent.disconnected") load();
|
if (evt.type === "agent.connected" || evt.type === "agent.disconnected") load();
|
||||||
});
|
});
|
||||||
|
// Récupère le prompt capturé tôt dans app.html avant que onMount soit prêt
|
||||||
|
if ((window as any).__installPrompt) {
|
||||||
|
installPrompt = (window as any).__installPrompt;
|
||||||
|
(window as any).__installPrompt = null;
|
||||||
|
}
|
||||||
window.addEventListener("beforeinstallprompt", onBeforeInstallPrompt);
|
window.addEventListener("beforeinstallprompt", onBeforeInstallPrompt);
|
||||||
window.addEventListener("appinstalled", onAppInstalled);
|
window.addEventListener("appinstalled", onAppInstalled);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user