From 82e9b20bbd31c6ea9a91b0c9dcde2f765f71b6bf Mon Sep 17 00:00:00 2001 From: Trey Smith Date: Wed, 25 Jan 2023 15:32:20 -0800 Subject: [PATCH] standalone.js: dispatch pannellumloaded event --- src/standalone/standalone.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/standalone/standalone.js b/src/standalone/standalone.js index c33155a..6eb6f79 100644 --- a/src/standalone/standalone.js +++ b/src/standalone/standalone.js @@ -10,6 +10,12 @@ function anError(error, showHTML) { document.getElementById('container').appendChild(errorMsg); } +function dispatchLoaded(configFromURL) { + var event = new Event('pannellumloaded'); + event.configFromURL = configFromURL; + document.dispatchEvent(event); +} + var viewer; function parseURLParameters() { var URL; @@ -113,6 +119,7 @@ function parseURLParameters() { // Create viewer configFromURL.escapeHTML = true; viewer = pannellum.viewer('container', configFromURL); + dispatchLoaded(configFromURL); }; request.open('GET', configFromURL.config); request.send(); @@ -127,6 +134,7 @@ function parseURLParameters() { configFromURL.escapeHTML = true; configFromURL.targetBlank = true; viewer = pannellum.viewer('container', configFromURL); + dispatchLoaded(configFromURL); } // Display error if opened from local file