Aligned to eslint rules and fixed following things:

This commit may contains behavioural changes.

- Fix for the issue with corrupted log displays
- Wrap the activeDocument
- Reduced potential type errors and strengthened certain checks
- Made error handling more robust (by rewriting the error class)
This commit is contained in:
vorotamoroz
2026-06-01 05:28:03 +01:00
parent c80c294d93
commit 7c203a522a
16 changed files with 130 additions and 107 deletions
+4 -3
View File
@@ -14,6 +14,7 @@ import type { InjectableServiceHub } from "@lib/services/implements/injectable/I
import type { LiveSyncCore } from "../../main.ts";
import { initialiseWorkerModule } from "@lib/worker/bgWorker.ts";
import { manifestVersion, packageVersion } from "@lib/common/coreEnvVars.ts";
import { compatGlobal } from "@lib/common/coreEnvFunctions.ts";
export class ModuleLiveSyncMain extends AbstractModule {
async _onLiveSyncReady() {
@@ -97,7 +98,7 @@ export class ModuleLiveSyncMain extends AbstractModule {
return false;
}
const lsKey = "obsidian-live-sync-ver" + this.services.vault.getVaultName();
const last_version = localStorage.getItem(lsKey);
const last_version = compatGlobal.localStorage.getItem(lsKey);
const lastVersion = ~~(versionNumberString2Number(manifestVersion) / 1000);
if (lastVersion > this.settings.lastReadUpdates && this.settings.isConfigured) {
@@ -119,7 +120,7 @@ export class ModuleLiveSyncMain extends AbstractModule {
this.settings.versionUpFlash = $msg("moduleLiveSyncMain.logVersionUpdate");
await this.saveSettings();
}
localStorage.setItem(lsKey, `${VER}`);
compatGlobal.localStorage.setItem(lsKey, `${VER}`);
await this.services.database.openDatabase({
databaseEvents: this.services.databaseEvents,
replicator: this.services.replicator,
@@ -129,7 +130,7 @@ export class ModuleLiveSyncMain extends AbstractModule {
// this.$$replicate = this.$$replicate.bind(this);
// this.core.$$onLiveSyncReady = this.core.$$onLiveSyncReady.bind(this);
await this.core.services.appLifecycle.onLoaded();
await Promise.all(this.core.addOns.map((e) => e.onload()));
await Promise.all(this.core.addOns.map((e) => Promise.resolve(e.onload())));
return true;
}