Skip to content

Commit

Permalink
Quick hack for global app
Browse files Browse the repository at this point in the history
  • Loading branch information
scambier committed May 18, 2024
1 parent 1a51415 commit 482a66e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App, Notice, Platform, Plugin } from 'obsidian'
import { App, Notice, Platform, Plugin, type PluginManifest } from 'obsidian'
import {
OmnisearchInFileModal,
OmnisearchVaultModal,
Expand All @@ -14,14 +14,13 @@ import {
import {
eventBus,
EventNames,
getTextExtractor,
indexingStep,
IndexingStepType,
isCacheEnabled,
} from './globals'
import api, { notifyOnIndexed } from './tools/api'
import { isFileIndexable, logDebug } from './tools/utils'
import { database, OmnisearchCache } from './database'
import { OmnisearchCache, database } from './database'
import * as NotesIndex from './notes-index'
import { searchEngine } from './search/omnisearch'
import { cacheManager } from './cache-manager'
Expand All @@ -32,8 +31,12 @@ export default class OmnisearchPlugin extends Plugin {
public apiHttpServer: null | any = null
private ribbonButton?: HTMLElement

async onload(): Promise<void> {
constructor(app: App, manifest: PluginManifest) {
super(app, manifest)
setObsidianApp(this.app)
}

async onload(): Promise<void> {
await loadSettings(this)
this.addSettingTab(new SettingsTab(this))

Expand Down
4 changes: 3 additions & 1 deletion src/stores/obsidian-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ export function setObsidianApp(app: App) {
*/
export function getObsidianApp() {
if (!obsidianApp) {
throw new Error('Obsidian app not set')
// throw new Error('Obsidian app not set')
// console.trace('Obsidian app not set')
return app // FIXME: please.
}
return obsidianApp as App
}

0 comments on commit 482a66e

Please sign in to comment.