Write Program
Write
JavaScript can also be compiled to WebAssembly.
The sample program is written like this.
javascript/prime.js
loading...
Here, Shopify
object is a special object as described in JavaScript and WASI.
This sample JavaScript program set run()
method as the entry-point of the WebAssembly.
Well the Javy Toolchain expects that our JavaScript code needs to define a global object where Shopify.main points to our main function.
var Shopify = {
main: run,
};