Work on client modes

This commit is contained in:
Zef Hemel
2023-08-29 21:17:29 +02:00
parent 5ff1a8bae3
commit 9a005f26b5
54 changed files with 594 additions and 302 deletions
+4 -3
View File
@@ -1,14 +1,15 @@
import { safeRun } from "../common/util.ts";
import { Client } from "./client.ts";
const thinClientMode = !!localStorage.getItem("thinClientMode");
const syncMode = window.silverBulletConfig.supportOnlineMode !== "true" ||
!!localStorage.getItem("syncMode");
safeRun(async () => {
console.log("Booting SilverBullet...");
const client = new Client(
document.getElementById("sb-root")!,
thinClientMode,
syncMode,
);
await client.init();
window.client = client;
@@ -22,7 +23,7 @@ if (navigator.serviceWorker) {
.then(() => {
console.log("Service worker registered...");
});
if (!thinClientMode) {
if (syncMode) {
navigator.serviceWorker.ready.then((registration) => {
registration.active!.postMessage({
type: "config",