import React from "react"; import ReactDOM from "react-dom/client"; import NoteApp from "./App.jsx"; // Hide splash screen const hideSplash = () => { const splash = document.getElementById("splash"); if (splash) { splash.classList.add("hide"); setTimeout(() => splash.remove(), 300); } }; ReactDOM.createRoot(document.getElementById("root")).render( ); setTimeout(hideSplash, 200); // Register service worker if ("serviceWorker" in navigator) { window.addEventListener("load", async () => { try { // Use the page's base URL as scope so it works behind any reverse proxy path const swUrl = new URL("./sw.js", window.location.href).href; const scope = new URL("./", window.location.href).href; const reg = await navigator.serviceWorker.register(swUrl, { scope }); console.log("[SW] Registered, scope:", reg.scope); setInterval(() => reg.update(), 60 * 60 * 1000); } catch (err) { console.warn("[SW] Registration failed:", err); } }); }