From e011e2505089d649c39af48de2fd7a04a2be5284 Mon Sep 17 00:00:00 2001 From: Sean Morris <640101+seanmorris@users.noreply.github.com> Date: Tue, 22 Oct 2024 19:44:42 -0400 Subject: [PATCH] Embeddable controls --- demo-web/src/InstallDemo.js | 10 ++++++++++ demo-web/src/index.js | 8 +++++++- docs/404.html | 2 +- docs/asset-manifest.json | 6 +++--- docs/code-editor.html | 2 +- docs/embedded-php.html | 2 +- docs/home.html | 2 +- docs/index.html | 2 +- docs/install-demo.html | 2 +- docs/select-framework.html | 2 +- docs/static/js/{main.470b598f.js => main.e97dccb8.js} | 6 +++--- ...98f.js.LICENSE.txt => main.e97dccb8.js.LICENSE.txt} | 0 .../js/{main.470b598f.js.map => main.e97dccb8.js.map} | 2 +- 13 files changed, 31 insertions(+), 15 deletions(-) rename docs/static/js/{main.470b598f.js => main.e97dccb8.js} (98%) rename docs/static/js/{main.470b598f.js.LICENSE.txt => main.e97dccb8.js.LICENSE.txt} (100%) rename docs/static/js/{main.470b598f.js.map => main.e97dccb8.js.map} (54%) diff --git a/demo-web/src/InstallDemo.js b/demo-web/src/InstallDemo.js index a3c6ef88..8e496625 100644 --- a/demo-web/src/InstallDemo.js +++ b/demo-web/src/InstallDemo.js @@ -11,6 +11,16 @@ import BackIcon from './icons/back-icon-32.png' import WwwIcon from './icons/www-icon-32.png' import editorIcon from './icons/editor-icon-32.png'; +navigator.serviceWorker.register(process.env.PUBLIC_URL + `/cgi-worker.js`); +setTimeout(() => { + if(!(navigator.serviceWorker && navigator.serviceWorker.controller)) + { + window.location.reload() + } +}, 350); + +(navigator.serviceWorker && navigator.serviceWorker.controller) || window.location.reload(); + const sendMessage = sendMessageFor((`${window.location.origin}${process.env.PUBLIC_URL}/cgi-worker.mjs`)) const packages = { diff --git a/demo-web/src/index.js b/demo-web/src/index.js index 5227f8ba..e8379d2c 100644 --- a/demo-web/src/index.js +++ b/demo-web/src/index.js @@ -16,8 +16,14 @@ const params = new URLSearchParams(window.location.search); if(!params.has('no-service-worker')) { navigator.serviceWorker.register(process.env.PUBLIC_URL + `/cgi-worker.js`); + setTimeout(() => { + if(!(navigator.serviceWorker && navigator.serviceWorker.controller)) + { + window.location.reload() + } + }, 350); + navigator.serviceWorker.addEventListener('message', onMessage); - setTimeout(() => navigator.serviceWorker.controller || window.location.reload(), 350); } const root = ReactDOM.createRoot(document.getElementById('root')); diff --git a/docs/404.html b/docs/404.html index aa0aa39c..6aa47434 100644 --- a/docs/404.html +++ b/docs/404.html @@ -1,4 +1,4 @@ -php-wasm