diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/routes/+layout.svelte | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 7e0d28a5..0d686f47 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -16,6 +16,11 @@ ? `http://${PUBLIC_DOMAIN}` : `https://${PUBLIC_DOMAIN}`; + function clearBadge() { + if ("clearAppBadge" in navigator) { + navigator.clearAppBadge().catch(() => {}); + } + } onMount(() => { if (!browser) return; @@ -25,6 +30,11 @@ $installPrompt = event; }); + clearBadge(); // first load + document.addEventListener("visibilitychange", () => { + if (document.visibilityState === "visible") clearBadge(); + }); + let hasNotch = typeof window.AndroidNotch !== "undefined"; if (hasNotch) { window.AndroidNotch.getInsetTop( |
