TEMPORARY: add testing example

This commit is contained in:
Ben Merritt 2019-06-05 22:58:11 -07:00
parent 7dabad4d71
commit 77cd3adb01
No known key found for this signature in database
GPG key ID: F8AD20ED4E6239B7
5 changed files with 42 additions and 5 deletions

View file

@ -5,22 +5,28 @@ extern crate stdweb;
#[cfg(feature = "wasm-bindgen")]
#[macro_use]
extern crate wasm_bindgen;
#[cfg(feature = "wasm-bindgen")]
extern crate web_sys;
use winit::window::WindowBuilder;
use winit::event::{Event, WindowEvent};
use winit::event_loop::{EventLoop, ControlFlow};
use wasm_bindgen::{prelude::*, JsValue};
use web_sys::console;
fn main() {
#[wasm_bindgen(start)]
pub fn main() {
console::log_1(&JsValue::from_str("main"));
let event_loop = EventLoop::new();
let _window = WindowBuilder::new()
.with_title("A fantastic window!")
.build(&event_loop)
.unwrap();
//console!(log, "Built window!");
console::log_1(&JsValue::from_str("Created window"));
event_loop.run(|event, _, control_flow| {
//console!(log, format!("{:?}", event));
console::log_1(&JsValue::from_str(&format!("{:?}", event)));
match event {
Event::WindowEvent {
@ -30,4 +36,4 @@ fn main() {
_ => *control_flow = ControlFlow::Wait,
}
});
}
}