diff --git a/eframe/src/lib.rs b/eframe/src/lib.rs index e09f8fd6..1175c2af 100644 --- a/eframe/src/lib.rs +++ b/eframe/src/lib.rs @@ -76,12 +76,6 @@ pub use epi::*; // ---------------------------------------------------------------------------- // When compiling for web -#[cfg(target_arch = "wasm32")] -use egui::mutex::Mutex; - -#[cfg(target_arch = "wasm32")] -use std::sync::Arc; - #[cfg(target_arch = "wasm32")] pub mod web; @@ -89,7 +83,8 @@ pub mod web; pub use wasm_bindgen; #[cfg(target_arch = "wasm32")] -use web::AppRunner; +use web::AppRunnerRef; + #[cfg(target_arch = "wasm32")] pub use web_sys; @@ -107,7 +102,7 @@ pub use web_sys; /// /// You can add more callbacks like this if you want to call in to your code. /// #[cfg(target_arch = "wasm32")] /// #[wasm_bindgen] -/// pub fn start(canvas_id: &str) -> Result>, eframe::wasm_bindgen::JsValue> { +/// pub fn start(canvas_id: &str) -> Result, eframe::wasm_bindgen::JsValue> { /// let web_options = eframe::WebOptions::default(); /// eframe::start_web(canvas_id, web_options, Box::new(|cc| Box::new(MyEguiApp::new(cc)))) /// } @@ -117,7 +112,7 @@ pub fn start_web( canvas_id: &str, web_options: WebOptions, app_creator: AppCreator, -) -> Result>, wasm_bindgen::JsValue> { +) -> Result { let handle = web::start(canvas_id, web_options, app_creator)?; Ok(handle) diff --git a/eframe/src/web/mod.rs b/eframe/src/web/mod.rs index f8a4fb49..98de396f 100644 --- a/eframe/src/web/mod.rs +++ b/eframe/src/web/mod.rs @@ -11,7 +11,6 @@ pub mod storage; mod text_agent; pub use backend::*; -use egui::Vec2; pub use events::*; pub use storage::*; @@ -21,6 +20,7 @@ use std::sync::{ Arc, }; +use egui::Vec2; use wasm_bindgen::prelude::*; use web_sys::EventTarget; diff --git a/egui_demo_app/src/lib.rs b/egui_demo_app/src/lib.rs index 786aa40d..8ae3f422 100644 --- a/egui_demo_app/src/lib.rs +++ b/egui_demo_app/src/lib.rs @@ -6,13 +6,7 @@ pub(crate) mod frame_history; mod wrap_app; #[cfg(target_arch = "wasm32")] -use std::sync::Arc; - -#[cfg(target_arch = "wasm32")] -use eframe::web::AppRunner; - -#[cfg(target_arch = "wasm32")] -use egui::mutex::Mutex; +use eframe::web::AppRunnerRef; pub use wrap_app::WrapApp; @@ -31,7 +25,7 @@ use eframe::wasm_bindgen::{self, prelude::*}; #[cfg(target_arch = "wasm32")] #[wasm_bindgen] pub struct WebHandle { - handle: Arc>, + handle: AppRunnerRef, } #[cfg(target_arch = "wasm32")]