1234567891011121314151617181920 |
- "use client";
- import { useEffect } from "react";
- export function ServiceWorkerRegistration() {
- useEffect(() => {
- if ("serviceWorker" in navigator) {
- navigator.serviceWorker
- .register("/sw.js")
- .then((registration) => {
- console.log("SW registered: ", registration);
- })
- .catch((registrationError) => {
- console.log("SW registration failed: ", registrationError);
- });
- }
- }, []);
- return null;
- }
|