mirror of
https://github.com/Ellpeck/ObsidianSimpleTimeTracker.git
synced 2024-12-18 03:29:24 +01:00
basic setup
This commit is contained in:
parent
e21f9f28ff
commit
186b13142f
1 changed files with 28 additions and 0 deletions
28
src/main.ts
Normal file
28
src/main.ts
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import { Plugin, Platform, WorkspaceLeaf } from "obsidian";
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue