~starkingdoms/starkingdoms

ref: d128f26234cf10b506de2e05f524a941d5691df3 starkingdoms/client/src/rendering/util.rs -rw-r--r-- 381 bytes
d128f262 — c0repwn3r translate server to protobuf protocol 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()
}