aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/+layout.svelte
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/+layout.svelte')
-rw-r--r--src/routes/+layout.svelte17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index 545018ed..43e573ef 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -2,6 +2,23 @@
import { PUBLIC_DOMAIN } from "$env/static/public";
import "../app.css";
import { loading, t } from "$lib/translations";
+ import { onMount } from "svelte";
+ import { dev } from "$app/environment";
+
+ onMount(() => {
+ if ("serviceWorker" in navigator) {
+ navigator.serviceWorker
+ .register("/service-worker.js", {
+ type: dev ? "module" : "classic",
+ })
+ .then((registration) => {
+ console.log("SW registered: ", registration);
+ })
+ .catch((registrationError) => {
+ console.log("SW registration failed: ", registrationError);
+ });
+ }
+ });
export let data;
let { pathname } = data;