eframe builds on web again

This commit is contained in:
kirjavascript 2022-10-05 00:29:04 +01:00
parent 9d4f9c44cb
commit 144ca9ef8d
2 changed files with 6 additions and 4 deletions

View file

@ -10,7 +10,7 @@ use eframe::wasm_bindgen::{self, prelude::*};
#[cfg(target_arch = "wasm32")]
#[wasm_bindgen]
pub fn start(canvas_id: &str) -> Result<(), eframe::wasm_bindgen::JsValue> {
pub fn start() {
// make sure panics are logged using `console.error`
console_error_panic_hook::set_once();
@ -18,7 +18,7 @@ pub fn start(canvas_id: &str) -> Result<(), eframe::wasm_bindgen::JsValue> {
tracing_wasm::set_as_global_default();
eframe::start_web(
canvas_id,
"emu",
Default::default(),
Box::new(|cc| Box::new(App::new(cc)))
).expect("eframe didnt load");

View file

@ -35,6 +35,8 @@ html {
overflow: hidden;
margin: 0 !important;
padding: 0 !important;
height: 100%;
width: 100%;
}
/* Position canvas in center-top: */
@ -97,7 +99,7 @@ html {
<body>
<!-- The WASM code will resize the canvas dynamically -->
<canvas id="the_canvas_id"></canvas>
<canvas id="emu"></canvas>
<div class="centered" id="center_text">
<p style="font-size:16px">
Loading…
@ -134,7 +136,7 @@ function on_wasm_loaded() {
console.debug("wasm loaded. starting app…");
// This call installs a bunch of callbacks and then returns:
wasm_bindgen.start("the_canvas_id");
wasm_bindgen.start();
console.debug("app started.");
document.getElementById("center_text").remove();