18 lines
409 B
TypeScript
18 lines
409 B
TypeScript
"use client";
|
|
|
|
import { useEffect } from "react";
|
|
|
|
export function ServiceWorkerRegister() {
|
|
useEffect(() => {
|
|
if (typeof window === "undefined" || !("serviceWorker" in navigator)) {
|
|
return;
|
|
}
|
|
|
|
navigator.serviceWorker.register("/sw.js").catch(() => {
|
|
// The app works without offline support, so registration failures stay silent in the demo MVP.
|
|
});
|
|
}, []);
|
|
|
|
return null;
|
|
}
|