Create and Run a Native WebAssembly Function

Share this video with your friends

Send Tweet

In this introduction, we show a simple WebAssembly function that returns the square root of a number. To create this function we load up WebAssembly Explorer (https://mbebenita.github.io/WasmExplorer/), writing the native WAST code to create and export the function. We compile and download the resulting WebAssembly binary, loading this with the Fetch API and WebAssembly JavaScript API to call the function in the browser.

Demo Repo: https://github.com/guybedford/wasm-intro

Brian
Brian
~ 7 years ago

Whoa it's Guy Bedford!

Zach Barnes
Zach Barnes
~ 7 years ago

Everything works fine when test.wasm is served, but when locally referenced, the test file is not able to be acquired.

Guy Bedford
Guy Bedford(instructor)
~ 7 years ago

Are you running a local server to serve the files? This is necessary for the loading to work.

Mateusz
Mateusz
~ 7 years ago
Feng Chen
Feng Chen
~ 7 years ago