Skip to content
A simple working example WebAssembly that fetches, compiles, and instantiates a local .wasm file.
JavaScript HTML
Branch: master
Clone or download
Latest commit c841060 Mar 20, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitattributes Initial commit Mar 20, 2018 First Commit Mar 20, 2018
index.html First Commit Mar 20, 2018
scripts.js First Commit Mar 20, 2018
squarer.wasm First Commit Mar 20, 2018


This is a boilerplate / demo of WebAssembly. It uses a very simple C++ function (which takes a number as an argument and returns its square) in a wasm module, which can then be accessed & used from within the JS file. As soon as you pull it up on a localhost, the demo is ready to go; no configuration or setup necessary.

I should mention that because compilation of the wasm module is done asynchronously, you need to be sure that you don't try to use the C++ function (called 'squarer' in the JS file) before it's available. The easiest way to avoid this (assuming all you want to do is text your .wasm instances) would be to call the function from within your browser's console.

You can’t perform that action at this time.