mirror of
https://github.com/unarray/file-tree-generator.git
synced 2026-07-22 08:40:29 +00:00
Set FileTreeGenerator as Singleton
This commit is contained in:
parent
5877ff53ee
commit
73642928a1
1 changed files with 17 additions and 1 deletions
|
|
@ -1,9 +1,25 @@
|
|||
import { GenerateTree } from "#/commands/GenerateTree";
|
||||
import type { Command } from "obsidian";
|
||||
import type { App, Command, PluginManifest } from "obsidian";
|
||||
import { Plugin } from "obsidian";
|
||||
|
||||
export default class FileTreeGenerator extends Plugin {
|
||||
|
||||
private static instance: FileTreeGenerator;
|
||||
|
||||
private static setInstance = (instance: FileTreeGenerator): void => {
|
||||
FileTreeGenerator.instance = instance;
|
||||
};
|
||||
|
||||
public static getInstance = (): FileTreeGenerator => {
|
||||
return FileTreeGenerator.instance;
|
||||
};
|
||||
|
||||
constructor(app: App, manifest: PluginManifest) {
|
||||
super(app, manifest);
|
||||
FileTreeGenerator.setInstance(this);
|
||||
}
|
||||
|
||||
|
||||
onload(): void {
|
||||
this.addCommands(
|
||||
new GenerateTree()
|
||||
|
|
|
|||
Loading…
Reference in a new issue