Skip to content

Commit bf4d43e

Browse files
committed
Trigger event custom-sort:plugin-unload after unloading the plugin
1 parent 0fb39ae commit bf4d43e

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/main.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,8 @@ export default class CustomSortPlugin
683683
}
684684

685685
onunload() {
686+
// Trigger "plugin-unload" event
687+
this.app.workspace.trigger('custom-sort:plugin-unload');
686688
}
687689

688690
onUserEnable() {

src/types/types.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,9 @@ declare module 'obsidian' {
6262
interface MenuItem {
6363
setSubmenu: () => Menu;
6464
}
65+
66+
interface Workspace {
67+
// Augmented event, triggered after unloading the plugin
68+
on(name: 'custom-sort:plugin-unload', callback: () => unknown, ctx?: any): EventRef;
69+
}
6570
}

0 commit comments

Comments
 (0)