-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.ts
42 lines (37 loc) · 1.14 KB
/
main.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { Plugin } from 'obsidian';
import { TaskStatusPluginInterface, TaskStatusPluginSettings } from 'src/types';
import Settings from 'src/settings';
import registerRibbon from 'src/register-ribbon';
import changeTaskStatus from 'src/commands/open-task-quick-menu';
import DEFAULT_SETTINGS from 'src/default-settings';
export default class TaskStatusPlugin extends Plugin implements TaskStatusPluginInterface {
settings: TaskStatusPluginSettings;
/**
* Setup the plugin when it loads in obsidian
*/
async onload() {
console.log('loading Obsidian Task Status');
await this.loadSettings();
registerRibbon(this);
this.addCommand(changeTaskStatus(this));
this.addSettingTab(new Settings(this.app, this));
}
/**
* Teardown the plugin when it gets unloaded
*/
onunload() {
console.log('unloading Obsidian Task Status');
}
/**
* Trigger the rendering of the settings view
*/
async loadSettings() {
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
}
/**
* persist/save the plugin settings
*/
async saveSettings() {
await this.saveData(this.settings);
}
}