install service-worker

This commit is contained in:
2026-05-04 14:36:04 +03:30
parent 0f7c8343f6
commit 4ad8b6bc6c
2 changed files with 19 additions and 0 deletions

View File

@@ -1,3 +1,5 @@
"use client";
import React from "react";
export default function Home() {
@@ -95,3 +97,12 @@ export default function Home() {
</div>
);
}
if (typeof window !== "undefined") {
if ("ServiceWorker" in window) {
navigator.serviceWorker
.register("/service-worker.js")
.then(() => console.log("[ Registered ]"))
.catch((err) => console.log("[ Not Registered ]", err));
} else console.log("[ There Is No SW In Window ]");
}