- Application LifeCycle has now started in Main, not ServiceHub.

This commit is contained in:
vorotamoroz
2026-02-14 15:21:00 +09:00
parent fb59c4a723
commit 6e9ac6a9f9
10 changed files with 34 additions and 26 deletions

Submodule src/lib updated: 532f25f947...69e7a510f1

View File

@@ -205,8 +205,13 @@ export default class ObsidianLiveSyncPlugin
syncStatus: "CLOSED" as DatabaseConnectingStatus,
});
private async _startUp() {
await this.services.appLifecycle.onLoad();
const onReady = this.services.appLifecycle.onReady.bind(this.services.appLifecycle);
this.app.workspace.onLayoutReady(onReady);
}
onload() {
void this.services.appLifecycle.onLoad();
void this._startUp();
}
async saveSettings() {
await this.services.setting.saveSettingData();

View File

@@ -78,7 +78,7 @@ export class ModuleInitializerFile extends AbstractModule {
const _filesStorage = [] as typeof filesStorageSrc;
for (const f of filesStorageSrc) {
if (await this.services.vault.isTargetFile(f.path, f != filesStorageSrc[0])) {
if (await this.services.vault.isTargetFile(f.path)) {
_filesStorage.push(f);
}
}
@@ -122,7 +122,7 @@ export class ModuleInitializerFile extends AbstractModule {
);
const path = this.getPath(doc);
if (isValidPath(path) && (await this.services.vault.isTargetFile(path, true))) {
if (isValidPath(path) && (await this.services.vault.isTargetFile(path))) {
if (!isMetaEntry(doc)) {
this._log(`Invalid entry: ${path}`, LOG_LEVEL_INFO);
continue;

View File

@@ -133,7 +133,7 @@ export class ModuleMigration extends AbstractModule {
if (!isValidPath(path)) {
continue;
}
if (!(await this.services.vault.isTargetFile(path, true))) {
if (!(await this.services.vault.isTargetFile(path))) {
continue;
}
if (!isMetaEntry(metaDoc)) {

View File

@@ -69,7 +69,7 @@ export class ModuleObsidianEvents extends AbstractObsidianModule {
//@ts-ignore
window.CodeMirrorAdapter.commands.save = () => {
//@ts-ignore
_this.app.commands.executeCommandById("editor:save-file");
void _this.app.commands.executeCommandById("editor:save-file");
// _this.app.performCommand('editor:save-file');
};
}

View File

@@ -9,12 +9,6 @@ declare module "obsidian" {
}
// InjectableAppLifecycleService
export class ObsidianAppLifecycleService<T extends ObsidianServiceContext> extends AppLifecycleServiceBase<T> {
constructor(context: T) {
super(context);
// The main entry point when Obsidian's workspace is ready
const onReady = this.onReady;
this.context.app.workspace.onLayoutReady(onReady);
}
performRestart(): void {
void this.context.plugin.app.commands.executeCommandById("app:reload");
}