You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
37 lines
1.1 KiB
import { initBackend } from "absurd-sql/dist/indexeddb-main-thread";
|
|
import { initializeApp } from "./main.common";
|
|
import { logger } from "./utils/logger";
|
|
|
|
const platform = process.env.VITE_PLATFORM;
|
|
const pwa_enabled = process.env.VITE_PWA_ENABLED === "true";
|
|
|
|
logger.info("[Web] PWA enabled", { pwa_enabled });
|
|
logger.info("[Web] Platform", { platform });
|
|
|
|
// Only import service worker for web builds
|
|
if (platform !== "electron" && pwa_enabled) {
|
|
import("./registerServiceWorker"); // Web PWA support
|
|
}
|
|
|
|
const app = initializeApp();
|
|
|
|
function sqlInit() {
|
|
// see https://github.com/jlongster/absurd-sql
|
|
const worker = new Worker(
|
|
new URL("./registerSQLWorker.js", import.meta.url),
|
|
{
|
|
type: "module",
|
|
},
|
|
);
|
|
// This is only required because Safari doesn't support nested
|
|
// workers. This installs a handler that will proxy creating web
|
|
// workers through the main thread
|
|
initBackend(worker);
|
|
}
|
|
if (platform === "web" || platform === "development") {
|
|
sqlInit();
|
|
} else {
|
|
logger.info("[Web] SQL not initialized for platform", { platform });
|
|
}
|
|
|
|
app.mount("#app");
|
|
|