mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 22:00:03 -04:00
upd
This commit is contained in:
@@ -51,12 +51,9 @@ impl WebHandle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[cfg(target_arch = "wasm32")]
|
#[cfg(target_arch = "wasm32")]
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
pub fn init_wasm_hooks(){
|
pub fn init_wasm_hooks() {
|
||||||
// Make sure panics are logged using `console.error`.
|
// Make sure panics are logged using `console.error`.
|
||||||
console_error_panic_hook::set_once();
|
console_error_panic_hook::set_once();
|
||||||
|
|
||||||
@@ -64,7 +61,6 @@ pub fn init_wasm_hooks(){
|
|||||||
tracing_wasm::set_as_global_default();
|
tracing_wasm::set_as_global_default();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[cfg(target_arch = "wasm32")]
|
#[cfg(target_arch = "wasm32")]
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
pub fn start_separate(canvas_id: &str) -> Result<WebHandle, wasm_bindgen::JsValue> {
|
pub fn start_separate(canvas_id: &str) -> Result<WebHandle, wasm_bindgen::JsValue> {
|
||||||
@@ -75,11 +71,10 @@ pub fn start_separate(canvas_id: &str) -> Result<WebHandle, wasm_bindgen::JsValu
|
|||||||
Box::new(|cc| Box::new(WrapApp::new(cc))),
|
Box::new(|cc| Box::new(WrapApp::new(cc))),
|
||||||
)
|
)
|
||||||
.map(|handle| WebHandle { handle });
|
.map(|handle| WebHandle { handle });
|
||||||
|
|
||||||
handle
|
handle
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// This is the entry-point for all the web-assembly.
|
/// This is the entry-point for all the web-assembly.
|
||||||
/// This is called once from the HTML.
|
/// This is called once from the HTML.
|
||||||
/// It loads the app, installs some callbacks, then returns.
|
/// It loads the app, installs some callbacks, then returns.
|
||||||
@@ -87,7 +82,6 @@ pub fn start_separate(canvas_id: &str) -> Result<WebHandle, wasm_bindgen::JsValu
|
|||||||
#[cfg(target_arch = "wasm32")]
|
#[cfg(target_arch = "wasm32")]
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
pub fn start(canvas_id: &str) -> Result<WebHandle, wasm_bindgen::JsValue> {
|
pub fn start(canvas_id: &str) -> Result<WebHandle, wasm_bindgen::JsValue> {
|
||||||
|
|
||||||
init_wasm_hooks();
|
init_wasm_hooks();
|
||||||
start_separate(canvas_id)
|
start_separate(canvas_id)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user