mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-18 15:31:25 +00:00
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:
@ -8,7 +8,7 @@ use wasm_bindgen::JsCast;
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn draw() {
|
||||
let document = web_sys::Window::document().unwrap();
|
||||
let document = web_sys::window().unwrap().document().unwrap();
|
||||
let canvas = document.get_element_by_id("canvas").unwrap();
|
||||
let canvas: web_sys::HtmlCanvasElement = canvas
|
||||
.dyn_into::<web_sys::HtmlCanvasElement>()
|
||||
|
Reference in New Issue
Block a user