stylist 0.15.1

Stylist is a CSS-in-Rust styling solution for WebAssembly Applications.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::{Error, Result};
use web_sys::Window;
#[cfg(target_arch = "wasm32")]
use web_sys::{Document, HtmlHeadElement};

pub(crate) fn window() -> Result<Window> {
    web_sys::window().ok_or(Error::Web(None))
}

#[cfg(target_arch = "wasm32")]
pub(crate) fn document() -> Result<Document> {
    window()?.document().ok_or(Error::Web(None))
}

#[cfg(target_arch = "wasm32")]
pub(crate) fn doc_head() -> Result<HtmlHeadElement> {
    document()?.head().ok_or(Error::Web(None))
}