✨ 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
This commit is contained in:
Miguel de Benito Delgado 2026-09-19 20:43:32 +02:00
parent 23109b71fe
commit 3b35187676

View File

@ -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.