Skip to content

Commit 0fb39ae

Browse files
committed
Get App instance from the view instead of the leaf
Adheres to public API instead.
1 parent ecab803 commit 0fb39ae

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/utils/UndeferHandler.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { App, Component, Plugin, View, WorkspaceLeaf } from 'obsidian';
1+
import { App, Component, View, WorkspaceLeaf } from 'obsidian';
22

33
export class UndeferHandler extends Component {
44
app: App;
@@ -8,7 +8,7 @@ export class UndeferHandler extends Component {
88

99
constructor(leaf: WorkspaceLeaf, callback: (leaf: WorkspaceLeaf) => unknown) {
1010
super();
11-
this.app = leaf.app;
11+
this.app = leaf.view.app;
1212
this.leaf = leaf;
1313
this.view = leaf.view;
1414
this.callback = callback;
@@ -24,7 +24,7 @@ export class UndeferHandler extends Component {
2424
}
2525

2626
// Detach the handler once the plugin has been disabled/unistalled
27-
this.registerEvent(this.app.workspace.on(`custom-sort:plugin-unload`, () => this.detach()));
27+
this.registerEvent(this.app.workspace.on('custom-sort:plugin-unload', () => this.detach()));
2828
}
2929

3030
onunload(): void {

0 commit comments

Comments
 (0)