Skip to content

Browser: printing-receipt loading splash while the WASM runtime downloads - #18

Merged
danielmeza merged 1 commit into
mainfrom
feat/browser-loading-indicator
Sep 22, 2026
Merged

danielmeza merged 1 commit into
mainfrom
feat/browser-loading-indicator

Conversation

@danielmeza

@danielmeza danielmeza commented Sep 22, 2026 •

Copy link
Copy Markdown
Owner

Replaces the blank page shown while the browser version downloads (~45 MB, 235 files) with a loading splash in the app's own language: a small thermal printer prints a receipt of the download.

What it does

  • One receipt line per downloaded file. Each line shows the name, with the build hash stripped, and the size. The paper feeds up in motor steps, older lines fade out at the top, and a status LED blinks while it prints.
  • Hand-off. When the runtime is ready, the receipt prints the total and a barcode, the status switches to "Starting the emulator…", and Avalonia's first frame fades the splash out. Avalonia 12 adds .splash-close to #avalonia-splash, and main.js adds it too after runMain as a fallback.
  • Failure. The LED turns red, the receipt prints *** PRINT FAILED *** at once, and the status says to reload, followed by the underlying error.
  • Accessibility. Only phase changes are announced (role="status"), not each receipt line. With prefers-reduced-motion, lines appear without the feed animation and the LED doesn't blink.
  • Where the data comes from. The Resource Timing API (PerformanceObserver), so names and sizes are real and cache hits count. The first commit used onDownloadResourceProgress. That hook isn't in dotnet.d.ts, and its file total grows during startup (25, then 54, then 140), so progress could jump backwards.

Tested locally

I published with -c Release -p:PublishTrimmed=false -p:CompressionEnabled=false, served wwwroot, and drove Chromium via Playwright:

  • Throttled to 30 Mbit/s: lines print as files arrive, and the splash hands off to the app at about 13 s.
  • Unthrottled: no script errors, and the app starts normally.
  • Runtime blocked (dotnet.native*.wasm aborted): the error state shows the red LED, the PRINT FAILED line and the error message.

Merging redeploys the Pages demo. No new tag is needed.

🤖 Generated with Claude Code

The page stayed blank until the ~50 MB runtime had downloaded and Avalonia drew its first frame
(over a minute on a slow connection). index.html now carries an #avalonia-splash: a receipt feeds
out of a printer slot as files arrive (the loader's onDownloadResourceProgress), with a
"Downloaded N of M files" count, then "Starting the emulator…". Avalonia adds .splash-close on its
first frame; main.js also closes it once Main has run. If start-up fails, the splash stays up with
the error and a reload hint instead of a blank page.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@danielmeza
danielmeza merged commit d410401 into main Sep 22, 2026
1 check passed
@danielmeza danielmeza changed the title Browser: show a loading indicator while the WASM runtime downloads Browser: printing-receipt loading splash while the WASM runtime downloads Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant