Play with WebAssembly WASM
Lundi 22 janvier 2018WebAssembly is assmbly in webbrowser. You can run C, C++, other language faster than javascript.
Code Source: wasm.zip
1. Compile Code
Just go to https://wasdk.github.io/WasmFiddle/ type your code, click on build, and download WebAssemenbly binary.
int main() {
return 42;
}
2. Make HTML
Now you can make HTML page like that
fetch('program.wasm').then(response =>
response.arrayBuffer()
).then(bytes =>
WebAssembly.instantiate(bytes)
).then(results => {
console.log( results.instance.exports.main() );
});
3. Run
Open you HTML file in your browser and see result.