32 lines
701 B
TypeScript
32 lines
701 B
TypeScript
import { ItemView, WorkspaceLeaf } from "obsidian";
|
|
import { STATS_ICON_NAME, VIEW_TYPE_STATS } from "src/constants";
|
|
import type BetterWordCount from "src/main";
|
|
//@ts-ignore
|
|
import Statistics from "./Statistics.svelte";
|
|
|
|
export default class StatsView extends ItemView {
|
|
private plugin: BetterWordCount;
|
|
private statistics: Statistics;
|
|
|
|
constructor(leaf: WorkspaceLeaf) {
|
|
super(leaf);
|
|
}
|
|
|
|
getViewType(): string {
|
|
return VIEW_TYPE_STATS;
|
|
}
|
|
|
|
getDisplayText(): string {
|
|
return "Statistics";
|
|
}
|
|
|
|
getIcon(): string {
|
|
return STATS_ICON_NAME;
|
|
}
|
|
|
|
async onOpen(): Promise<void> {
|
|
this.statistics = new Statistics({
|
|
target: (this as any).contentEl,
|
|
});
|
|
}
|
|
}
|