From 74f64f76d24a9ae3192384586344f35a398daa47 Mon Sep 17 00:00:00 2001 From: Alexander Date: Tue, 8 Oct 2024 20:11:45 +0200 Subject: [PATCH] registeredEvents --- main.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/main.ts b/main.ts index 36f05e9..7dadef9 100644 --- a/main.ts +++ b/main.ts @@ -116,8 +116,11 @@ export default class VaultReviewPlugin extends Plugin { this.addSettingTab(new VaultReviewSettingTab(this.app, this)); // Events - this.app.vault.on("rename", this.handleFileRename); - this.app.vault.on("delete", this.handleFileDelete); + this.registerEvent(this.app.vault.on("rename", this.handleFileRename)); + this.registerEvent(this.app.vault.on("delete", this.handleFileDelete)); + this.registerEvent( + this.app.workspace.on("file-open", this.statusBar.update) + ); }; onunload = () => {}; @@ -329,9 +332,7 @@ class StatusBar { element.createSpan("status").setText("Not reviewed"); element.addClass("mod-clickable"); - - this.element.addEventListener("click", this.onClick); - this.plugin.app.workspace.on("file-open", this.update); + element.addEventListener("click", this.onClick); this.update(); }