magnetar/fe_calckey/frontend/client/src/scripts/initialize-sw.ts

14 lines
377 B
TypeScript
Raw Normal View History

2023-07-07 19:22:30 +00:00
import { lang } from "@/config";
export async function initializeSw() {
if (!("serviceWorker" in navigator)) return;
2023-07-07 19:22:30 +00:00
navigator.serviceWorker.register("/sw.js", { scope: "/", type: "classic" });
navigator.serviceWorker.ready.then((registration) => {
registration.active?.postMessage({
msg: "initialize",
lang,
});
});
2023-07-07 19:22:30 +00:00
}