forked from obsidianmd/obsidian-sample-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
notify.ts
23 lines (18 loc) · 730 Bytes
/
notify.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { Notice } from 'obsidian';
export default class Notify {
statusBarItem: HTMLElement;
constructor(statusBarItem: HTMLElement) {
this.statusBarItem = statusBarItem;
}
notice(message: string, duration = 5000) {
new Notice(message, duration);
}
// Intended to use event emitters to pass status message updates back to main module rather than write directly to statusBarItem here,
// but encountered issues with using event the `app.on` syntax provided in Obsidian API, so writing directly to the statusBar for now to solve the problem.
setStatusBarText(message: string) {
this.statusBarItem.setText(message);
}
getStatusBarText(): string {
return this.statusBarItem.textContent;
}
}