Answers for "Getting Started with AssemblyScript"

1

Getting Started with AssemblyScript

/*
    This code comes from Vincent Lab
    And it has a video version linked here: https://www.youtube.com/watch?v=ETrbk6khfwE
*/

// Import dependencies
import { AsBind } from "as-bind";
import fs from "fs";

(async () => {
    // Load in the wasm file
    const wasm = fs.readFileSync("./main.wasm");

    // Instantiate the wasm file, and pass in our importObject
    const instance = await AsBind.instantiate(wasm, {
        utils: {
            log(message) {
                console.log(message);
            }
        }
    });

    // Run main
    instance.exports.printName("Bob",10);
})();
Posted by: Guest on April-20-2021

Code answers related to "Getting Started with AssemblyScript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language