Add in WASM
Client
request = new XMLHttpRequest();
request.open('GET', '/example-add.wasm');
request.responseType = 'arraybuffer';
request.send();
request.onload = function() {
var bytes = request.response;
webassemblyjs
.instantiate(bytes)
.then((module) => {
var res = module.instance.exports.add(1, 1);
document.getElementById("res").innerHTML = res;
});
};
Result
...
Binary
The binary is available here: https://webassembly.js.org/example-add.wasm.