1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#![cfg_attr(docsrs, feature(doc_cfg))]
pub mod errors;
pub mod iter;
pub mod format {
mod json;
#[cfg(feature = "serde")]
pub use json::JsValueSerdeExt;
}
use wasm_bindgen::UnwrapThrowExt;
pub fn window() -> web_sys::Window {
web_sys::window().expect_throw("Can't find the global Window")
}
pub fn head() -> web_sys::HtmlHeadElement {
document()
.head()
.expect_throw("Can't find the head element")
}
pub fn document() -> web_sys::Document {
window().document().expect_throw("Can't find document")
}
pub fn body() -> web_sys::HtmlElement {
document().body().expect_throw("Can't find document body")
}
pub fn document_element() -> web_sys::Element {
document()
.document_element()
.expect_throw("Can't find document element")
}
pub fn history() -> web_sys::History {
window().history().expect_throw("Can't find history")
}