2023-07-07 19:22:30 +00:00
|
|
|
import { lang } from "@/config";
|
|
|
|
|
|
|
|
export async function initializeSw() {
|
2023-07-23 13:31:28 +00:00
|
|
|
if (!("serviceWorker" in navigator)) return;
|
2023-07-07 19:22:30 +00:00
|
|
|
|
2023-07-23 13:31:28 +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
|
|
|
}
|