Hacker News new | ask | show | jobs
by seanmcdirmid 2803 days ago
WASM is the new and shiny also. I'm not even sure what to do with it ATM given that the DOM story still hasn't been figured out.
3 comments

There is a DOM story: host bindings. It just isn't implemented yet.

However, that doesn't mean that you can't use it now. wasm-bindgen is essentially a polyfill for host bindings plus some other little things.

Some resources to check out if you want to learn more:

* Host bindings: https://github.com/WebAssembly/host-bindings/blob/master/pro...

* More info about web-sys (web-sys is like the raw libc for the web): https://rustwasm.github.io/wasm-bindgen/web-sys/index.html

* API documentation for web-sys: https://docs.rs/web-sys/0.3.2/web_sys/

* DOM hello world example: https://rustwasm.github.io/wasm-bindgen/examples/dom.html

* A mini MS Paint style example: https://rustwasm.github.io/wasm-bindgen/examples/paint.html

* An FM synth in WebAudio: https://rustwasm.github.io/wasm-bindgen/examples/web-audio.h...

Even though the DOM story hasn't been figured out, firefox has recently done work to make WASM <-> JS calls performant. So now things like Yew will probably be usable from a performance standpoint[0]. But apart from the DOM, it's good for CPU intensive things[1].

[0] Yew: https://github.com/DenisKolodin/yew [1] Refactoring a CPU intensive JS thing: https://hacks.mozilla.org/2018/01/oxidizing-source-maps-with...

As a child raised on 80s 8-bit computers, and a fan of emulation, I love what WASM does for in-browser emulators. You can run an enormous amount of Apple II, Commodore 64, etc. software on archive.org, all compiled using emscripten.