diff --git a/Cargo.lock b/Cargo.lock index 1add5eb3..8d14654b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -436,6 +436,16 @@ dependencies = [ "memchr", ] +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if 1.0.0", + "wasm-bindgen", +] + [[package]] name = "copypasta" version = "0.7.1" @@ -863,6 +873,7 @@ name = "egui_web" version = "0.16.0" dependencies = [ "bytemuck", + "console_error_panic_hook", "egui", "egui_glow", "epi", @@ -2597,9 +2608,9 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] name = "wasm-bindgen" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" +checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -2607,9 +2618,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b" +checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca" dependencies = [ "bumpalo", "lazy_static", @@ -2634,9 +2645,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" +checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2644,9 +2655,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" +checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc" dependencies = [ "proc-macro2", "quote", @@ -2657,9 +2668,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" +checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2" [[package]] name = "wayland-client" diff --git a/egui_web/CHANGELOG.md b/egui_web/CHANGELOG.md index 3964e70e..f76bdb30 100644 --- a/egui_web/CHANGELOG.md +++ b/egui_web/CHANGELOG.md @@ -7,8 +7,9 @@ All notable changes to the `egui_web` integration will be noted in this file. * The default painter is now glow instead of WebGL ([#1020](https://github.com/emilk/egui/pull/1020)). * Made the WebGL painter opt-in ([#1020](https://github.com/emilk/egui/pull/1020)). * Fixed glow failure on Chromium ([#1092](https://github.com/emilk/egui/pull/1092)). -* Shift-scroll will now result in horizontal scrolling on all platforms ([#1136](https://github.com/emilk/egui/pull/1136)). +* Shift-scroll will now result in horizontal scrolling ([#1136](https://github.com/emilk/egui/pull/1136)). * Updated `epi::IntegrationInfo::web_location_hash` on `hashchange` event ([#1140](https://github.com/emilk/egui/pull/1140)). +* Panics will now be logged using `console.error`. ## 0.16.0 - 2021-12-29 diff --git a/egui_web/Cargo.toml b/egui_web/Cargo.toml index 1a3395b1..ee2659c6 100644 --- a/egui_web/Cargo.toml +++ b/egui_web/Cargo.toml @@ -34,6 +34,7 @@ egui_glow = { version = "0.16.0",path = "../egui_glow", default-features = false epi = { version = "0.16.0", path = "../epi" } bytemuck = "1.7" +console_error_panic_hook = "0.1.6" js-sys = "0.3" ron = { version = "0.7", optional = true } serde = { version = "1", optional = true } diff --git a/egui_web/src/backend.rs b/egui_web/src/backend.rs index 9d893e3a..2b8118f6 100644 --- a/egui_web/src/backend.rs +++ b/egui_web/src/backend.rs @@ -281,6 +281,9 @@ impl AppRunner { /// Install event listeners to register different input events /// and start running the given app. pub fn start(canvas_id: &str, app: Box) -> Result { + // Make sure panics are logged using `console.error`. + console_error_panic_hook::set_once(); + let mut runner = AppRunner::new(canvas_id, app)?; runner.warm_up()?; start_runner(runner)