Skip to content

Commit

Permalink
Define window.ObsidianZoomPlugin in production env
Browse files Browse the repository at this point in the history
  • Loading branch information
vslinko committed May 23, 2021
1 parent 20fcc75 commit 4e248ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/ObsidianZoomPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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();
}
Expand Down
7 changes: 0 additions & 7 deletions src/ObsidianZoomPluginWithTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down

0 comments on commit 4e248ac

Please sign in to comment.