summaryrefslogtreecommitdiffstats
path: root/examples/tour
diff options
context:
space:
mode:
Diffstat (limited to 'examples/tour')
-rw-r--r--examples/tour/Cargo.toml8
-rw-r--r--examples/tour/src/main.rs7
2 files changed, 15 insertions, 0 deletions
diff --git a/examples/tour/Cargo.toml b/examples/tour/Cargo.toml
index 21206ecb..9e984ad1 100644
--- a/examples/tour/Cargo.toml
+++ b/examples/tour/Cargo.toml
@@ -9,4 +9,12 @@ 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"
diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs
index af508206..3387b481 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().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())