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