2020-10-18 13:40:23 +00:00
|
|
|
#![forbid(unsafe_code)]
|
2020-12-18 21:19:56 +00:00
|
|
|
#![cfg_attr(not(debug_assertions), deny(warnings))] // Forbid warnings in release builds
|
2020-05-10 17:04:10 +00:00
|
|
|
#![warn(clippy::all)]
|
|
|
|
|
2019-02-09 22:00:07 +00:00
|
|
|
use wasm_bindgen::prelude::*;
|
2020-04-12 10:07:51 +00:00
|
|
|
|
2020-07-18 16:35:17 +00:00
|
|
|
/// This is the entry-point for all the web-assembly.
|
2020-11-17 22:24:14 +00:00
|
|
|
/// 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.
|
2020-07-18 16:35:17 +00:00
|
|
|
#[wasm_bindgen]
|
2020-07-18 22:44:06 +00:00
|
|
|
pub fn start(canvas_id: &str) -> Result<(), wasm_bindgen::JsValue> {
|
2020-11-17 22:24:14 +00:00
|
|
|
let app = egui::DemoApp::default();
|
2020-09-16 06:03:40 +00:00
|
|
|
let backend = egui_web::WebBackend::new(canvas_id)?;
|
2020-11-17 22:24:14 +00:00
|
|
|
let runner = egui_web::AppRunner::new(backend, Box::new(app))?;
|
2020-10-17 10:33:30 +00:00
|
|
|
egui_web::start(runner)?;
|
2020-07-18 16:35:17 +00:00
|
|
|
Ok(())
|
2020-07-18 16:00:05 +00:00
|
|
|
}
|