0.1.0 • Published 6 years ago

@calvinchengx/hellowasm v0.1.0

Weekly downloads
1
License
-
Repository
-
Last release
6 years ago

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.