Created
January 4, 2020 04:54
-
-
Save torch2424/4ec76ede1382e46ba6eaf0a76a5bf57c to your computer and use it in GitHub Desktop.
Asbind announcment article JavaScript snipper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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