ObsidianSimpleTimeTracker/src/main.ts

29 lines
722 B
TypeScript
Raw Normal View History

2022-09-27 15:36:25 +02:00
import { Plugin } from "obsidian";
2022-09-27 15:36:00 +02:00
import { defaultSettings, SimpleTimeTrackerSettings } from "./settings";
import { SimpleTimeTrackerSettingsTab } from "./settings-tab";
export default class SimpleTimeTrackerPlugin extends Plugin {
settings: SimpleTimeTrackerSettings;
async onload(): Promise<void> {
await this.loadSettings();
this.addSettingTab(new SimpleTimeTrackerSettingsTab(this.app, this));
this.registerMarkdownCodeBlockProcessor("simple-time-tracker", (s, e) => {
e.empty();
e.addClass("simple-time-tracker");
});
}
async loadSettings() {
this.settings = Object.assign({}, defaultSettings, await this.loadData());
}
async saveSettings() {
await this.saveData(this.settings);
}
}