~starkingdoms/starkingdoms

ref: ffbbb9a837237aeb3a385e918f53d03dd7f96e2d starkingdoms/client/src/rendering/util.rs -rw-r--r-- 381 bytes
ffbbb9a8core Merge branch 'master' into 'feat/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()
}