UI improvements
This commit is contained in:
13
src/lib.rs
13
src/lib.rs
@@ -35,9 +35,16 @@ pub fn start(canvas_id: &str) -> Result<(), wasm_bindgen::JsValue> {
|
||||
init_tracing_wasm();
|
||||
|
||||
// Used in order to hook into `panic!()` to log in the browser's console
|
||||
log_helper("Initializing console_error_panic_hook...");
|
||||
std::panic::set_hook(Box::new(console_error_panic_hook::hook));
|
||||
log_helper("Initialized console_error_panic_hook!");
|
||||
log_helper("Initializing panic hooks...");
|
||||
std::panic::set_hook(Box::new(|panic_info| {
|
||||
web_sys::window()
|
||||
.and_then(|window| window.document())
|
||||
.and_then(|document| document.body())
|
||||
.and_then(|element| element.set_attribute("data-panicked", "true").ok());
|
||||
|
||||
console_error_panic_hook::hook(panic_info);
|
||||
}));
|
||||
log_helper("Initialized panic hooks!");
|
||||
|
||||
log_helper("Finished initializing!");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user