()
+ .expect("the_canvas_id was not a HtmlCanvasElement");
+
+ let start_result = eframe::WebRunner::new()
+ .start(
+ canvas,
+ web_options,
+ Box::new(|cc| Ok(Box::new(app::App::new(cc)))),
+ )
+ .await;
+
+ // Remove the loading text and spinner:
+ if let Some(loading_text) = document.get_element_by_id("loading_text") {
+ match start_result {
+ Ok(_) => {
+ loading_text.remove();
+ }
+ Err(e) => {
+ loading_text.set_inner_html(
+ " The app has crashed. See the developer console for details.
",
+ );
+ panic!("Failed to start eframe: {e:?}");
+ }
+ }
+ }
+ });
+}
\ No newline at end of file