Skip to content

Commit

Permalink
Add loading indicator to web demo
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyparrish committed Oct 16, 2024
1 parent 0d75cc2 commit 3ec9304
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions emulator-patches/web-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
// AudioContext needs a user gesture to start. So we define main, but don't
// run it until the user clicks the click-to-start button.
async function main() {
// Hide the click-to-start button.
clickToStart.style.display = 'none';
// Change the click-to-start label to a loading indicator.
clickToStart.innerText = 'Loading...'

// Launch the emulator, which will create its own canvas.
const nostalgist = await Nostalgist.launch({
Expand All @@ -74,6 +74,10 @@
wasm: 'genesis_plus_gx_libretro.wasm',
},
rom: 'kinetoscope-streamer.rom',
onLaunch: () => {
// Once loaded, hide the click-to-start button.
clickToStart.style.display = 'none';
},
});

// Resize the emulator when the window changes size.
Expand Down

0 comments on commit 3ec9304

Please sign in to comment.