web_panic_hook 0.1.0

Panic handling in the browser (wasm)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#![recursion_limit = "512"]

use std::fs;

use html::root::Html;

fn main() {
    const SCRIPT: &str = "import init, {} from './example.js';\
                          init('./example_bg.wasm');";

    let html = Html::builder()
        .head(|h| h.script(|s| s.type_("module").push(SCRIPT)))
        .body(|b| b)
        .build();

    fs::create_dir("./html").unwrap();
    fs::write("./html/index.html", html.to_string()).unwrap();
}