This commit is contained in:
talorr
2026-03-27 03:36:08 +03:00
parent 8a97ce6d54
commit cda36918e8
225 changed files with 35641 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
export default defineNuxtPlugin(async () => {
const { setInstallPromptEvent, isNativeApp } = usePush();
if (isNativeApp()) {
return;
}
if ("serviceWorker" in navigator) {
await navigator.serviceWorker.register("/sw.js");
}
window.addEventListener("beforeinstallprompt", (event) => {
event.preventDefault();
setInstallPromptEvent(event as Event & {
prompt: () => Promise<void>;
userChoice: Promise<{ outcome: "accepted" | "dismissed"; platform: string }>;
});
});
window.addEventListener("appinstalled", () => {
setInstallPromptEvent(null);
});
});