feat: add panic hook by default

This commit is contained in:
Jonathan Kelley 2022-01-24 02:57:56 -05:00
parent d9a07ddddb
commit 1406c9020b
2 changed files with 8 additions and 15 deletions

View File

@ -20,7 +20,7 @@ wasm-bindgen-futures = "0.4.20"
log = { version = "0.4.14", features = ["release_max_level_off"] }
fxhash = "0.2.1"
wasm-logger = "0.2.0"
console_error_panic_hook = "0.1.6"
console_error_panic_hook = { version = "0.1.7", optional = true }
wasm-bindgen-test = "0.3.21"
once_cell = "1.8"
async-channel = "1.6.1"
@ -69,22 +69,11 @@ features = [
"IdleDeadline",
]
# [lib]
# crate-type = ["cdylib", "rlib"]
[features]
default = ["panic_hook"]
panic_hook = ["console_error_panic_hook"]
[dev-dependencies]
dioxus-core-macro = { path = "../core-macro" }
wasm-bindgen-test = "0.3.28"
dioxus-ssr = { path = "../ssr" }
# im-rc = "15.0.0"
# separator = "0.4.1"
# uuid = { version = "0.8.2", features = ["v4", "wasm-bindgen"] }
# serde = { version = "1.0.126", features = ["derive"] }
# reqwest = { version = "0.11", features = ["json"] }
# dioxus-hooks = { path = "../hooks" }
# rand = { version = "0.8.4", features = ["small_rng"] }
# [dev-dependencies.getrandom]
# version = "0.2"
# features = ["js"]

View File

@ -120,6 +120,10 @@ pub fn launch_with_props<T, F>(
T: Send + 'static,
F: FnOnce(WebConfig) -> WebConfig,
{
if cfg!(feature = "panic_hook") {
console_error_panic_hook::set_once();
}
let config = configuration_builder(WebConfig::default());
wasm_bindgen_futures::spawn_local(run_with_props(root_component, root_properties, config));
}