Skip to content

Instantly share code, notes, and snippets.

@torch2424
Created January 4, 2020 04:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save torch2424/4ec76ede1382e46ba6eaf0a76a5bf57c to your computer and use it in GitHub Desktop.
Save torch2424/4ec76ede1382e46ba6eaf0a76a5bf57c to your computer and use it in GitHub Desktop.
Asbind announcment article JavaScript snipper
import { AsBind } from "as-bind";
const wasm = fetch("./path-to-my-wasm.wasm");
const asyncTask = async () => {
const asBindInstance = await AsBind.instantiate(wasm);
// You can now use your wasm / asbind instance!
const response = asBindInstance.exports.myExportedFunctionThatTakesAString(
"Hello World!"
);
console.log(response); // AsBind: Hello World!
};
asyncTask();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment