1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 13:50:04 -04:00

Graceful exit from web (#1650)

Return a handle that can be used to stop a running egui instance.
This commit is contained in:
Stanislav
2022-08-02 18:42:55 +03:00
committed by GitHub
parent 3eccd341ad
commit 64496cacb9
10 changed files with 432 additions and 50 deletions

View File

@@ -33,6 +33,8 @@
overflow: hidden;
margin: 0 !important;
padding: 0 !important;
height: 100%;
width: 100%;
}
/* Position canvas in center-top: */
@@ -131,7 +133,11 @@
console.debug("wasm loaded. starting app…");
// This call installs a bunch of callbacks and then returns:
wasm_bindgen.start("the_canvas_id");
const handle = wasm_bindgen.start("the_canvas_id");
// call `handle.stop_web()` to stop
// uncomment to quick result
// setTimeout(() => {handle.stop_web(); handle.free())}, 2000)
console.debug("app started.");
document.getElementById("center_text").remove();