Web frontend
This commit is contained in:
23
web/src/main.tsx
Normal file
23
web/src/main.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import { StrictMode } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
|
||||
import { App } from "./App";
|
||||
import "./styles/app.css";
|
||||
|
||||
createRoot(document.getElementById("root")!).render(
|
||||
<StrictMode>
|
||||
<App />
|
||||
</StrictMode>,
|
||||
);
|
||||
|
||||
// Registered after load so it never competes with the first paint. It is what makes
|
||||
// iOS offer "Zum Home-Bildschirm" as an app rather than a bookmark; see public/sw.js
|
||||
// for what it does and deliberately does not cache.
|
||||
if ("serviceWorker" in navigator && import.meta.env.PROD) {
|
||||
window.addEventListener("load", () => {
|
||||
void navigator.serviceWorker.register("/sw.js").catch(() => {
|
||||
// A plain http:// origin that is not localhost cannot register one. The app
|
||||
// works exactly the same, it just cannot be installed.
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user