mirror of
https://github.com/Nystik-gh/ignis.git
synced 2026-06-17 04:35:53 +00:00
refactor headless sync
This commit is contained in:
@@ -2,6 +2,7 @@ const { Plugin } = require("obsidian");
|
||||
const { HeadlessSyncSettingTab } = require("./settings-tab");
|
||||
const { WsListener } = require("./ws-listener");
|
||||
const { initSyncStatusBar } = require("./sync-status-bar");
|
||||
const { startCoreSyncWatcher } = require("./core-sync-guard");
|
||||
const api = require("./api");
|
||||
|
||||
class IgnisHeadlessSyncPlugin extends Plugin {
|
||||
@@ -13,6 +14,8 @@ class IgnisHeadlessSyncPlugin extends Plugin {
|
||||
|
||||
this.addSettingTab(new HeadlessSyncSettingTab(this.app, this));
|
||||
|
||||
this._coreSyncWatcher = startCoreSyncWatcher(this, api, this.wsListener);
|
||||
|
||||
this.addCommand({
|
||||
id: "start-sync",
|
||||
name: "Start server-side sync",
|
||||
@@ -50,6 +53,11 @@ class IgnisHeadlessSyncPlugin extends Plugin {
|
||||
}
|
||||
|
||||
onunload() {
|
||||
if (this._coreSyncWatcher) {
|
||||
this._coreSyncWatcher.cleanup();
|
||||
this._coreSyncWatcher = null;
|
||||
}
|
||||
|
||||
if (this._syncStatusBarCleanup) {
|
||||
this._syncStatusBarCleanup();
|
||||
this._syncStatusBarCleanup = null;
|
||||
|
||||
Reference in New Issue
Block a user