Fix Stop button killing audio: use full page reload to terminate Web Workers and AudioContexts that js-dos spawns internally
This commit is contained in:
@@ -64,21 +64,10 @@
|
|||||||
booting = false;
|
booting = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function stopEmulator() {
|
function stopEmulator() {
|
||||||
// Save reference then null it so the unmount cleanup doesn't double-try
|
// Full page reload to guarantee all workers, AudioContexts,
|
||||||
const ci = dosCI;
|
// and WebAssembly threads are fully terminated
|
||||||
dosCI = null;
|
window.location.href = `/#/game/${game.id}`;
|
||||||
|
|
||||||
// Properly stop the emulator
|
|
||||||
if (ci) {
|
|
||||||
try { await ci.exit(); } catch (_) {}
|
|
||||||
}
|
|
||||||
if (dosContainer) {
|
|
||||||
dosContainer.innerHTML = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
running = false;
|
|
||||||
push(`/game/${game.id}`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$effect(() => { load(); });
|
$effect(() => { load(); });
|
||||||
|
|||||||
Reference in New Issue
Block a user