~starkingdoms/starkingdoms

ref: 63975cc0a233df1da0d741ce5e246b08059d20e4 starkingdoms/client/src/rendering/util.rs -rw-r--r-- 381 bytes
63975cc0 — c0repwn3r extend module system in client 2 years ago
                                                                                
1
2
3
4
5
6
7
8
use web_sys::HtmlImageElement;
use wasm_bindgen::JsCast;

pub fn texid_to_html_image_unchecked(tex: &str) -> HtmlImageElement {
    let window = web_sys::window().expect("window needs to exist");
    let document = window.document().expect("window.document needs to exist");
    document.get_element_by_id(&format!("tex-{}", tex)).unwrap().dyn_into::<HtmlImageElement>().unwrap()
}