Browse Source

egui_web: log panics using console.error

pull/1193/head
Emil Ernerfeldt 3 years ago
parent
commit
ef81a52951
  1. 31
      Cargo.lock
  2. 3
      egui_web/CHANGELOG.md
  3. 1
      egui_web/Cargo.toml
  4. 3
      egui_web/src/backend.rs

31
Cargo.lock

@ -436,6 +436,16 @@ dependencies = [
"memchr", "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]] [[package]]
name = "copypasta" name = "copypasta"
version = "0.7.1" version = "0.7.1"
@ -863,6 +873,7 @@ name = "egui_web"
version = "0.16.0" version = "0.16.0"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"console_error_panic_hook",
"egui", "egui",
"egui_glow", "egui_glow",
"epi", "epi",
@ -2597,9 +2608,9 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
[[package]] [[package]]
name = "wasm-bindgen" name = "wasm-bindgen"
version = "0.2.78" version = "0.2.79"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"wasm-bindgen-macro", "wasm-bindgen-macro",
@ -2607,9 +2618,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-backend" name = "wasm-bindgen-backend"
version = "0.2.78" version = "0.2.79"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b" checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca"
dependencies = [ dependencies = [
"bumpalo", "bumpalo",
"lazy_static", "lazy_static",
@ -2634,9 +2645,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro" name = "wasm-bindgen-macro"
version = "0.2.78" version = "0.2.79"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01"
dependencies = [ dependencies = [
"quote", "quote",
"wasm-bindgen-macro-support", "wasm-bindgen-macro-support",
@ -2644,9 +2655,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro-support" name = "wasm-bindgen-macro-support"
version = "0.2.78" version = "0.2.79"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2657,9 +2668,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-shared" name = "wasm-bindgen-shared"
version = "0.2.78" version = "0.2.79"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2"
[[package]] [[package]]
name = "wayland-client" name = "wayland-client"

3
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)). * 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)). * 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)). * 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)). * 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 ## 0.16.0 - 2021-12-29

1
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" } epi = { version = "0.16.0", path = "../epi" }
bytemuck = "1.7" bytemuck = "1.7"
console_error_panic_hook = "0.1.6"
js-sys = "0.3" js-sys = "0.3"
ron = { version = "0.7", optional = true } ron = { version = "0.7", optional = true }
serde = { version = "1", optional = true } serde = { version = "1", optional = true }

3
egui_web/src/backend.rs

@ -281,6 +281,9 @@ impl AppRunner {
/// Install event listeners to register different input events /// Install event listeners to register different input events
/// and start running the given app. /// and start running the given app.
pub fn start(canvas_id: &str, app: Box<dyn epi::App>) -> Result<AppRunnerRef, JsValue> { pub fn start(canvas_id: &str, app: Box<dyn epi::App>) -> Result<AppRunnerRef, JsValue> {
// Make sure panics are logged using `console.error`.
console_error_panic_hook::set_once();
let mut runner = AppRunner::new(canvas_id, app)?; let mut runner = AppRunner::new(canvas_id, app)?;
runner.warm_up()?; runner.warm_up()?;
start_runner(runner) start_runner(runner)

Loading…
Cancel
Save