The maintainer of this website has a Spotify Coding Playlist of their Lo-fi Hip Hop beats!
So first, let's create our
exports.ts AssemblyScript file:
Then, let's compile that into a wasm module, using the AssemblyScript Compiler, which will output a
asc exports.ts -b exports.wasm
Next, Let's load / instantiate the wasm module,
export-function.wasm in a new
export-function.js file. Looking at the WebAssembly Module Documentation, We see that after instantiation of our module, our Module has a
.instance property, which is a WebAssembly Module Instance. An example of instantiating a module can be found in the Hello World Example. Lastly, we see that our instance has an
.exports property. The
.valueOf() depending on if they are exports as WebAssembly Globals. See the snippet below:
Lastly, lets load our ES6 Module,
index.html. And you should get something similar to the demo (Source Code) below!
Next let's take a look at WebAssembly Linear Memory.