forked from trent_larson/crowd-funder-for-time-pwa
28 lines
817 B
TypeScript
28 lines
817 B
TypeScript
// @ts-expect-error but not sure why it's not in there
|
|
import { initBackend } from "absurd-sql/dist/indexeddb-main-thread";
|
|
import { initializeApp } from "./main.common";
|
|
|
|
// Only import service worker for web builds
|
|
if (process.env.VITE_PLATFORM !== 'electron' && process.env.VITE_PWA_ENABLED === 'true') {
|
|
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);
|
|
}
|
|
sqlInit();
|
|
|
|
app.mount("#app");
|