Skip to content

Commit

Permalink
Merge pull request #19 from ras0q/fix/unload
Browse files Browse the repository at this point in the history
🐛 fix  typos
  • Loading branch information
ras0q committed Jun 5, 2024
2 parents 3ef2a21 + 80abe03 commit 39a55e2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 7 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import { MarkdownView, Platform, Plugin, WorkspaceRoot } from "obsidian";
export default class GraphBannerPlugin extends Plugin {
static graphBannerNodeClass = "graph-banner-content";

onUnload: (() => void)[] = [];
unloadListeners: (() => void)[] = [];
graphNode: Element | null = null;

async onload() {
console.log("Loading GraphBannerPlugin");

// NOTE: https://github.com/mgmeyers/obsidian-style-settings?tab=readme-ov-file#plugin-support
this.app.workspace.trigger("parse-style-settings");

Expand Down Expand Up @@ -39,7 +41,7 @@ export default class GraphBannerPlugin extends Plugin {
mainWindow.focus();
}

this.onUnload.push(() => {
this.unloadListeners.push(() => {
graphWindow.closable && graphWindow.close();
});
}),
Expand Down Expand Up @@ -108,14 +110,14 @@ export default class GraphBannerPlugin extends Plugin {
);
}

async unload() {
async onunload() {
console.log("Unloading GraphBannerPlugin");

this.graphNode?.removeClass(GraphBannerPlugin.graphBannerNodeClass);
this.graphNode = null;

for (const handleUnload of this.onUnload) {
handleUnload();
for (const unloadCallback of this.unloadListeners) {
unloadCallback();
}
}

Expand Down
4 changes: 2 additions & 2 deletions styles.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* https://github.com/mgmeyers/obsidian-style-settings */
/* @settings
name: Braph Banner
id: braph-banner
name: Graph Banner
id: graph-banner
settings:
- id: banner-height
title: Banner Height
Expand Down

0 comments on commit 39a55e2

Please sign in to comment.