So I am trying to build a wasm module that have functions compatile with the main function, i.e. compilable with both lib.rs and main.rs.
I need to download a font, and for wasm, I guess putting async into it is the only way????
However, doing so would need to make the main function async, but Tokio is not yet supported with wasm.
So what are my option, including somekind of dependency config in cargo.toml is fine.
Thank you.
(Also, that do make me wonder if can I self-impliment a Future with polling and while loop to check polling ready, so that I do not neet to use async anymore)
Calling block_on on a future that internally uses a javascript promise doesn't work for wasm. The javascript promise won't be fulfilled until you yield the javascript event loop, which block_on won't do by definition. For working with javascript promises you should use the wasm_bindgen_futures crate.