pub fn start_web(
canvas: HtmlCanvasElement,
source: String,
font: Vec<u8>,
base: Option<String>,
)Expand description
Boot Rux onto an existing <canvas>, rendering source.
font is a font file’s bytes, and is not optional in practice: a browser
exposes no system font source, so without it every family query misses and
the app renders as silent blank boxes. See TextEngine::register_font.
Returns immediately: spawn_app gives the event loop to the browser instead
of blocking, so the caller keeps running. Errors in source are reported and
replaced with an empty document, matching what the native loader does with an
unreadable file.
base is the path the app is served under, and giving one is what makes the
URL bar the app’s address bar: the document opens on the route the URL
names, navigating pushes a history entry, and the browser’s Back and Forward
walk the app. Without it the URL is left alone entirely and the document
opens at /, which is what the playground needs: it runs documents written
by other people on a page of somebody else’s site.