From 3b35187676f66c642f6858852a20bd2ab7cc7be3 Mon Sep 17 00:00:00 2001 From: Miguel de Benito Delgado Date: Sat, 19 Sep 2026 20:43:32 +0200 Subject: [PATCH] :sparkles: Expose the playground adapter for console access mountScenario now assigns the mounted renderer to globalThis.playgroundAdapter and removes it on dispose, so the wasm module is reachable from the browser console on every playground page (for example playgroundAdapter.module._render_stats()). The benchmark verify-pages diagnostic already used this name by patching the served lib.js. The source is now the canonical writer, so the wrapper's assignment is redundant. AI-assisted-by: deepseek-flash --- frontend/resources/wasm-playground/js/lib.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/resources/wasm-playground/js/lib.js b/frontend/resources/wasm-playground/js/lib.js index b51e60ca06..4096bd1d65 100644 --- a/frontend/resources/wasm-playground/js/lib.js +++ b/frontend/resources/wasm-playground/js/lib.js @@ -243,9 +243,14 @@ export async function mountScenario( const dispose = () => { globalThis.removeEventListener("pagehide", dispose); adapter.dispose(); + if (globalThis.playgroundAdapter === renderer) { + delete globalThis.playgroundAdapter; + } }; globalThis.addEventListener("pagehide", dispose, { once: true }); - return { ...adapter, dispose }; + const renderer = { ...adapter, dispose }; + globalThis.playgroundAdapter = renderer; + return renderer; } // Compatibility for the older, explicitly noncanonical comparison.html page.