From d53be922fede8208c45b79247bf19ead16af923a Mon Sep 17 00:00:00 2001 From: Stephen Cooper Date: Wed, 10 Jul 2024 13:47:47 -0400 Subject: [PATCH] fix: syrinscape not initialized if player is closed --- src/SyrinscapePlayerView.ts | 2 -- src/main.ts | 7 +++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/SyrinscapePlayerView.ts b/src/SyrinscapePlayerView.ts index 912ebd1..61d7970 100644 --- a/src/SyrinscapePlayerView.ts +++ b/src/SyrinscapePlayerView.ts @@ -188,8 +188,6 @@ export class SyrinscapePlayerView extends ItemView { * and after onOpen has been called. */ async activateSyrinscape() { - console.log('Syrinscape - Activating Syrinscape player.'); - await syrinscape.config.init() if (!syrinscape?.player?.syncSystem?.events) { console.error('Syrinscape - activateSyrinscape called before syrinscape.player.syncSystem.events is available.'); return; diff --git a/src/main.ts b/src/main.ts index eb37e5c..c451335 100644 --- a/src/main.ts +++ b/src/main.ts @@ -80,7 +80,6 @@ export default class SyrinscapePlugin extends Plugin { // "Reveal" the leaf in case it is in a collapsed sidebar workspace.revealLeaf(leaf); } - console.debug("Syrinscape - leaf:", leaf); } } @@ -176,7 +175,11 @@ export default class SyrinscapePlugin extends Plugin { .catch(error => console.error("Error loading script:", error)); this.loadExternalScript("https://syrinscape.com/visualisation.js") - .then(() => console.debug("Script loaded successfully.")) + .then(() => { + console.debug("Script loaded successfully."); + console.log('Syrinscape - Activating Syrinscape player.'); + syrinscape.config.init() + }) .catch(error => console.error("Error loading script:", error)); } /**