async_ui_web_core 0.2.1

Async UI for the Browser
Documentation
1
2
3
4
5
6
7
8
9
use wasm_bindgen::UnwrapThrowExt;
use web_sys::{Document, Window};

thread_local! {
    /// The window object. Put in a thread local to avoid frequent unwraps.
    pub static WINDOW: Window = web_sys::window().unwrap_throw();
    /// The document object. Put in a thread local to avoid frequent unwraps.
    pub static DOCUMENT: Document = web_sys::window().unwrap_throw().document().unwrap_throw();
}