@calvinchengx/hellowasm
v0.1.0
Published
## Initial Setup
Downloads
2
Readme
Hello WASM
Initial Setup
rustup target add wasm32-unknown-unknown --toolchain nightly
cargo +nightly install wasm-bindgen-cli
cargo +nightly new hellowasm --lib
Update cargo.toml
[lib]
crate-type = ["cdylib"]
[dependencies]
wasm-bindgen = "0.2"
Development
Build our project
cargo +nightly build --target wasm32-unknown-unknown
wasm-bindgen target/wasm32-unknown-unknown/debug/hellowasm.wasm --out-dir .
Now, in our plain javascript file index.js
, we can import our generated hellowasm.js
and use the greet function.