Add skeleton for file event handling
This commit is contained in:
parent
1420cf104e
commit
8a7cc65e88
6 changed files with 259 additions and 4 deletions
42
plugin/src/views/sync-view.ts
Normal file
42
plugin/src/views/sync-view.ts
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import { ItemView, WorkspaceLeaf } from "obsidian";
|
||||
import { Logger } from "src/logger";
|
||||
|
||||
export class SyncView extends ItemView {
|
||||
public static TYPE = "example-view";
|
||||
|
||||
constructor(leaf: WorkspaceLeaf) {
|
||||
super(leaf);
|
||||
}
|
||||
|
||||
getViewType() {
|
||||
return SyncView.TYPE;
|
||||
}
|
||||
|
||||
getDisplayText() {
|
||||
return "Example view";
|
||||
}
|
||||
|
||||
async onOpen() {
|
||||
const container = this.containerEl.children[1];
|
||||
container.empty();
|
||||
container.createEl("h4", { text: "Example view" });
|
||||
|
||||
setInterval(() => this.updateView(), 1000);
|
||||
}
|
||||
|
||||
async updateView() {
|
||||
const container = this.containerEl.children[1];
|
||||
container.empty();
|
||||
|
||||
const messages = Logger.getInstance()
|
||||
.getMessages()
|
||||
.map((message) => message.toString())
|
||||
.join("\n");
|
||||
|
||||
container.createEl("pre", { text: messages });
|
||||
}
|
||||
|
||||
async onClose() {
|
||||
// Nothing to clean up.
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue