mmastrac / rust-ctor

Module initialization/global constructor functions for Rust
Apache License 2.0
739 stars 49 forks source link

Add WASM support #273

Open notgull opened 1 year ago

notgull commented 1 year ago

Maybe we could get the functions to fire once document.onload is called?

stan-stately commented 8 months ago

Just use wasm_bindgen(start)

#[cfg_attr(not(target_family = "wasm"), ctor::ctor)]
#[cfg_attr(target_family = "wasm", wasm_bindgen(start))]
fn init() {
    // ...
}
mmastrac commented 5 months ago

I can try implementing this, but I don't have a good toolchain setup to test.