diff options
Diffstat (limited to '')
| -rw-r--r-- | examples/tour/Cargo.toml | 5 | ||||
| -rw-r--r-- | examples/tour/src/main.rs | 7 | 
2 files changed, 12 insertions, 0 deletions
diff --git a/examples/tour/Cargo.toml b/examples/tour/Cargo.toml index 9de017ce..11920e0d 100644 --- a/examples/tour/Cargo.toml +++ b/examples/tour/Cargo.toml @@ -9,8 +9,13 @@ publish = false  iced.workspace = true  iced.features = ["image", "debug"] +[target.'cfg(not(target_arch = "wasm32"))'.dependencies]  tracing-subscriber = "0.3"  [target.'cfg(target_arch = "wasm32")'.dependencies]  iced.workspace = true  iced.features = ["image", "debug", "webgl"] + +console_error_panic_hook = "0.1" +console_log = "1.0" +log.workspace = true diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs index af508206..f0e3c0cd 100644 --- a/examples/tour/src/main.rs +++ b/examples/tour/src/main.rs @@ -8,6 +8,13 @@ use iced::widget::{Button, Column, Container, Slider};  use iced::{Color, Element, Font, Length, Renderer, Sandbox, Settings};  pub fn main() -> iced::Result { +    #[cfg(target_arch = "wasm32")] +    { +        console_log::init_with_level(log::Level::Debug).expect("Initialize logger"); +        std::panic::set_hook(Box::new(console_error_panic_hook::hook)); +    } + +    #[cfg(not(target_arch = "wasm32"))]      tracing_subscriber::fmt::init();      Tour::run(Settings::default())  | 
