Add a top-level web_sys::window function

Returns `Option<Window>` and can be used as a convenience to get a handle to the
global `window` object.
This commit is contained in:
Alex Crichton
2018-09-17 14:25:04 -07:00
parent 99e1b352e5
commit f24828a16b
5 changed files with 19 additions and 4 deletions

View File

@ -9,7 +9,7 @@ use wasm_bindgen::JsCast;
#[wasm_bindgen]
pub fn main() {
let document = web_sys::Window::document().unwrap();
let document = web_sys::window().unwrap().document().unwrap();
let canvas = document
.create_element("canvas")
.unwrap()