Reorder initialization
This commit is contained in:
parent
a9227fa5bb
commit
eb6f7d5a58
1 changed files with 21 additions and 23 deletions
|
|
@ -2,7 +2,7 @@ import type { WorkspaceLeaf } from "obsidian";
|
|||
import { Plugin } from "obsidian";
|
||||
import "./styles.scss";
|
||||
import "../manifest.json";
|
||||
import init, { setPanicHook } from "sync_lib";
|
||||
import init from "sync_lib";
|
||||
import wasmBin from "sync_lib/sync_lib_bg.wasm";
|
||||
import { SyncSettingsTab } from "./views/settings-tab";
|
||||
import { HistoryView } from "./views/history-view";
|
||||
|
|
@ -32,8 +32,6 @@ export default class VaultLinkPlugin extends Plugin {
|
|||
(wasmBin as any).default // it is loaded as a base64 string by webpack
|
||||
);
|
||||
|
||||
setPanicHook();
|
||||
|
||||
const database = new Database(
|
||||
await this.loadData(),
|
||||
this.saveData.bind(this)
|
||||
|
|
@ -67,6 +65,26 @@ export default class VaultLinkPlugin extends Plugin {
|
|||
|
||||
new StatusBar(database, this, this.history, syncer);
|
||||
|
||||
this.registerView(
|
||||
HistoryView.TYPE,
|
||||
(leaf) => new HistoryView(leaf, database, this.history)
|
||||
);
|
||||
this.registerView(
|
||||
LogsView.TYPE,
|
||||
(leaf) => new LogsView(this, database, leaf)
|
||||
);
|
||||
|
||||
this.addRibbonIcon(
|
||||
HistoryView.ICON,
|
||||
"Open VaultLink events",
|
||||
async (_: MouseEvent) => this.activateView(HistoryView.TYPE)
|
||||
);
|
||||
this.addRibbonIcon(
|
||||
LogsView.ICON,
|
||||
"Open VaultLink logs",
|
||||
async (_: MouseEvent) => this.activateView(LogsView.TYPE)
|
||||
);
|
||||
|
||||
const eventHandler = new ObsidianFileEventHandler(syncer);
|
||||
|
||||
this.app.workspace.onLayoutReady(async () => {
|
||||
|
|
@ -119,26 +137,6 @@ export default class VaultLinkPlugin extends Plugin {
|
|||
}
|
||||
});
|
||||
|
||||
this.registerView(
|
||||
HistoryView.TYPE,
|
||||
(leaf) => new HistoryView(leaf, database, this.history)
|
||||
);
|
||||
this.registerView(
|
||||
LogsView.TYPE,
|
||||
(leaf) => new LogsView(this, database, leaf)
|
||||
);
|
||||
|
||||
this.addRibbonIcon(
|
||||
HistoryView.ICON,
|
||||
"Open VaultLink events",
|
||||
async (_: MouseEvent) => this.activateView(HistoryView.TYPE)
|
||||
);
|
||||
this.addRibbonIcon(
|
||||
LogsView.ICON,
|
||||
"Open VaultLink logs",
|
||||
async (_: MouseEvent) => this.activateView(LogsView.TYPE)
|
||||
);
|
||||
|
||||
Logger.getInstance().info("Plugin loaded");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue