From 4e248ac690091b97df13f2f3088fa84d1b2d908c Mon Sep 17 00:00:00 2001 From: Viacheslav Slinko Date: Sun, 23 May 2021 17:10:59 +0300 Subject: [PATCH] Define window.ObsidianZoomPlugin in production env --- src/ObsidianZoomPlugin.ts | 4 ++++ src/ObsidianZoomPluginWithTests.ts | 7 ------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/ObsidianZoomPlugin.ts b/src/ObsidianZoomPlugin.ts index 7fbf8f7..73cc443 100644 --- a/src/ObsidianZoomPlugin.ts +++ b/src/ObsidianZoomPlugin.ts @@ -26,6 +26,8 @@ export default class ObsidianZoomPlugin extends Plugin { async onload() { console.log(`Loading obsidian-zoom`); + (window as any).ObsidianZoomPlugin = this; + this.settingsService = new SettingsService(this); await this.settingsService.load(); @@ -66,6 +68,8 @@ export default class ObsidianZoomPlugin extends Plugin { async onunload() { console.log(`Unloading obsidian-zoom`); + delete (window as any).ObsidianZoomPlugin; + for (const feature of this.features) { await feature.unload(); } diff --git a/src/ObsidianZoomPluginWithTests.ts b/src/ObsidianZoomPluginWithTests.ts index 7e03c91..9a0c901 100644 --- a/src/ObsidianZoomPluginWithTests.ts +++ b/src/ObsidianZoomPluginWithTests.ts @@ -78,8 +78,6 @@ export default class ObsidianZoomPluginWithTests extends ObsidianZoomPlugin { async load() { await super.load(); - (window as any).ObsidianZoomPlugin = this; - if (process.env.TEST_PLATFORM) { setImmediate(async () => { await this.wait(1000); @@ -88,11 +86,6 @@ export default class ObsidianZoomPluginWithTests extends ObsidianZoomPlugin { } } - async onunload() { - await super.onunload(); - delete (window as any).ObsidianZoomPlugin; - } - async prepareForTests() { const filePath = `test.md`; let file = this.app.vault