Skip to content

kainino0x/wasm-call-js-from-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Call JS from Rust in WebAssembly

Ever wondered how to do this super simple thing, which should be really easy but for which there is almost no documentation? Wonder no more! In just a few lines of arcane incantations in various languages, it's super easy!

(I kid! Only about 3 of the incantations are arcane!)

Live Demo (Open dev tools to see the console logs.)

Building

Requires Rust and Emscripten (obviously). Only tested on Linux.

make
# or
make debug
# or
make release

(Default is debug.)

Running

cd out/debug  # (or out/release)
python2 -m SimpleHTTPServer

Tutorial (Or: How To Do The Thing)

Really, there's so little code. Just take a look! (It's got comments, even.)

About

Minimal demo calling JavaScript from WebAssembly Rust code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published