generated from obsidianmd/obsidian-sample-plugin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.ts
37 lines (27 loc) · 1.21 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
import { App, Editor, MarkdownView, Modal, Notice, Plugin, PluginSettingTab, Setting } from 'obsidian';
import { LinkedinSyncSettings, DEFAULT_SETTINGS } from 'settings';
import LinkedinSyncSettingTab from 'settings-tab';
import { PostToLinkedinCommand } from 'commands/post';
import { LinkedinAPI } from 'api';
export default class LinkedinSync extends Plugin {
settings: LinkedinSyncSettings;
linkedin: any;
api: LinkedinAPI;
async onload() {
await this.loadSettings();
// This adds a settings tab so the user can configure various aspects of the plugin
this.addSettingTab(new LinkedinSyncSettingTab(this.app, this));
this.api = new LinkedinAPI(this.settings);
// This adds an editor command that can perform some operation on the current editor instance
this.addCommand(new PostToLinkedinCommand(this.api));
// When registering intervals, this function will automatically clear the interval when the plugin is disabled.
this.registerInterval(window.setInterval(() => console.log('setInterval'), 5 * 60 * 1000));
}
onunload() {}
async loadSettings() {
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
}
async saveSettings() {
await this.saveData(this.settings);
}
}