1pub use wasm_bindgen::prelude::JsValue;
2pub use web_sys::{Document, Element, Window};
3
4pub type ElementResult<T> = std::result::Result<T, JsValue>;
6
7pub fn document() -> Document {
9 let window = web_sys::window().expect("no global `window` exists");
10 window.document().expect("unable to get `document` node")
11}
12
13pub fn window() -> Window {
15 web_sys::window().expect("no global `window` exists")
16}
17
18pub fn get_element_by_id(id: &str) -> Option<Element> {
20 document().get_element_by_id(id)
21}