mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 13:20:05 -04:00
Add example_web app
This commit is contained in:
@@ -5,11 +5,14 @@
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
/// This is the entry-point for all the web-assembly.
|
||||
/// This is called once from the HTML.
|
||||
/// It loads the app, installs some callbacks, then returns.
|
||||
/// You can add more callbacks like this if you want to call in to your code.
|
||||
#[wasm_bindgen]
|
||||
pub fn start(canvas_id: &str) -> Result<(), wasm_bindgen::JsValue> {
|
||||
let app = egui::DemoApp::default();
|
||||
let backend = egui_web::WebBackend::new(canvas_id)?;
|
||||
let app = Box::new(egui::DemoApp::default());
|
||||
let runner = egui_web::AppRunner::new(backend, app)?;
|
||||
let runner = egui_web::AppRunner::new(backend, Box::new(app))?;
|
||||
egui_web::start(runner)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user