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