summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/application.rs19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/application.rs b/src/application.rs
index a7e4d8da..be0fa0de 100644
--- a/src/application.rs
+++ b/src/application.rs
@@ -208,11 +208,26 @@ where
..crate::renderer::Settings::default()
};
- Ok(crate::shell::application::run::<
+ let run = crate::shell::application::run::<
Instance<Self>,
Self::Executor,
crate::renderer::Compositor,
- >(settings.into(), renderer_settings)?)
+ >(settings.into(), renderer_settings);
+
+ #[cfg(target_arch = "wasm32")]
+ {
+ use crate::futures::FutureExt;
+ use iced_futures::backend::wasm::wasm_bindgen::Executor;
+
+ Executor::new()
+ .expect("Create Wasm executor")
+ .spawn(run.map(|_| ()));
+
+ Ok(())
+ }
+
+ #[cfg(not(target_arch = "wasm32"))]
+ Ok(crate::futures::executor::block_on(run)?)
}
}