Skip to main content

Intro

written by Martijn Benjamin (appeltje-c)

https://webassembly.org/

Nutshell

https://developer.mozilla.org/en-US/docs/WebAssembly

  • WebAssembly is a compile-targeted language for running bytecode on the web.
  • Relative to Javascript, WebAssembly offers predictable performance. It is not inherently faster than Javascript, but it can be faster than JavaScript in the correct use case. Such as computationally intensive tasks, like nested loops or handling large amounts of data. Therefore, WebAssembly is a complement to JavaScript, and not a replacement.
  • WebAssembly is extremely portable. WebAssembly runs on: all major web browsers, V8 runtimes like Node.js, and independent Wasm runtimes like Wasmtime, Lucet, and Wasmer.
  • WebAssembly has Linear Memory, in other words, one big expandable array. And in the context of Javascript, synchronously accessible by Javascript and Wasm.
  • WebAssembly can export functions and constants, And in the context of Javascript, synchronously accessible by Javascript and Wasm.
  • WebAssembly, in its current MVP, only handles integers and floats. However, tools and libraries exist to make passing high-level data types convenient.

Background

https://hacks.mozilla.org/2017/02/a-cartoon-intro-to-webassembly/

AssemblyScript

https://github.com/AssemblyScript https://www.assemblyscript.org/

React Hook

create react wasm hook https://codeburst.io/getting-started-with-react-and-webassembly-using-hooks-441818c91608

Rust https://www.rust-lang.org/learn https://rustlings.cool/

Make Tutorial based on this: https://wasmbyexample.dev/home.en-us.html

Config override to use wasm in create-react-app

https://stackoverflow.com/questions/59319775/how-to-use-webassembly-wasm-with-create-react-app

WASM in React

https://codeburst.io/getting-started-with-react-and-webassembly-using-hooks-441818c91608