Created
July 24, 2018 20:58
-
-
Save FreeMasen/ed8848c795c53d6d054bc5a2db5d9e1c to your computer and use it in GitHub Desktop.
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
| let wasm; | |
| fetch('/rust_program_name.wasm') | |
| .then(res => res.arrayBuffer()) | |
| .then(buf => { | |
| return WebAssembly.Instantiate(buf, importObject) | |
| .then(mod => { | |
| wasm = mod.instance.exports; | |
| start(); | |
| }); | |
| }); | |
| function start() { | |
| wasm.start(); | |
| } | |
| function wasm_one() { | |
| } | |
| function wasm_two() { | |
| } | |
| var importObject = { | |
| './rust_program_name': { | |
| wasm_one: wasm_one, | |
| wasm_two: wasm_two, | |
| }, | |
| '__wbindgen_placeholder__': { | |
| place_holder_fn: function() {}, | |
| wasm_two: function() {}, | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment