Simplification of this.app ==> app - this is a globally exposed object
This commit is contained in:
parent
150b864cae
commit
b752662d82
12
src/main.ts
12
src/main.ts
|
@ -72,7 +72,7 @@ export default class CustomSortPlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
readAndParseSortingSpec() {
|
readAndParseSortingSpec() {
|
||||||
const mCache: MetadataCache = this.app.metadataCache
|
const mCache: MetadataCache = app.metadataCache
|
||||||
let failed: boolean = false
|
let failed: boolean = false
|
||||||
let anySortingSpecFound: boolean = false
|
let anySortingSpecFound: boolean = false
|
||||||
let errorMessage: string | null = null
|
let errorMessage: string | null = null
|
||||||
|
@ -80,7 +80,7 @@ export default class CustomSortPlugin extends Plugin {
|
||||||
this.sortSpecCache = null
|
this.sortSpecCache = null
|
||||||
const processor: SortingSpecProcessor = new SortingSpecProcessor()
|
const processor: SortingSpecProcessor = new SortingSpecProcessor()
|
||||||
|
|
||||||
Vault.recurseChildren(this.app.vault.getRoot(), (file: TAbstractFile) => {
|
Vault.recurseChildren(app.vault.getRoot(), (file: TAbstractFile) => {
|
||||||
if (failed) return
|
if (failed) return
|
||||||
if (file instanceof TFile) {
|
if (file instanceof TFile) {
|
||||||
const aFile: TFile = file as TFile
|
const aFile: TFile = file as TFile
|
||||||
|
@ -245,7 +245,7 @@ export default class CustomSortPlugin extends Plugin {
|
||||||
this.ribbonIconStateInaccurate = true
|
this.ribbonIconStateInaccurate = true
|
||||||
}
|
}
|
||||||
|
|
||||||
this.addSettingTab(new CustomSortSettingTab(this.app, this));
|
this.addSettingTab(new CustomSortSettingTab(app, this));
|
||||||
|
|
||||||
this.registerEventHandlers()
|
this.registerEventHandlers()
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ export default class CustomSortPlugin extends Plugin {
|
||||||
const plugin: CustomSortPlugin = this
|
const plugin: CustomSortPlugin = this
|
||||||
this.registerEvent(
|
this.registerEvent(
|
||||||
// Keep in mind: this event is triggered once after app starts and then after each modification of _any_ metadata
|
// Keep in mind: this event is triggered once after app starts and then after each modification of _any_ metadata
|
||||||
this.app.metadataCache.on("resolved", () => {
|
app.metadataCache.on("resolved", () => {
|
||||||
if (!this.settings.suspended) {
|
if (!this.settings.suspended) {
|
||||||
if (!this.initialAutoOrManualSortingTriggered) {
|
if (!this.initialAutoOrManualSortingTriggered) {
|
||||||
this.readAndParseSortingSpec()
|
this.readAndParseSortingSpec()
|
||||||
|
@ -304,7 +304,7 @@ export default class CustomSortPlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
initialize() {
|
initialize() {
|
||||||
this.app.workspace.onLayoutReady(() => {
|
app.workspace.onLayoutReady(() => {
|
||||||
this.fileExplorerFolderPatched = this.patchFileExplorerFolder();
|
this.fileExplorerFolderPatched = this.patchFileExplorerFolder();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -365,7 +365,7 @@ export default class CustomSortPlugin extends Plugin {
|
||||||
|
|
||||||
// Credits go to https://github.com/nothingislost/obsidian-bartender
|
// Credits go to https://github.com/nothingislost/obsidian-bartender
|
||||||
getFileExplorer(): FileExplorerView | undefined {
|
getFileExplorer(): FileExplorerView | undefined {
|
||||||
let fileExplorer: FileExplorerView | undefined = this.app.workspace.getLeavesOfType("file-explorer")?.first()
|
let fileExplorer: FileExplorerView | undefined = app.workspace.getLeavesOfType("file-explorer")?.first()
|
||||||
?.view as unknown as FileExplorerView;
|
?.view as unknown as FileExplorerView;
|
||||||
return fileExplorer;
|
return fileExplorer;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue