summaryrefslogtreecommitdiff
path: root/WebInterface/wasm/asm-paint/loader.js
blob: 8348c3510725063e47b582676421740566181f5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
console.log('js> create import object');
let importObject = { imports: { imported_func: arg => console.log(arg) } };

console.log('js> create fetch object');

let asm_paint_bg = fetch('asm_paint_bg.wasm');

console.log('js> instantiate streaming');

function and_then(obj) {
   console.log('js> reached instantiate streaming\'s then');
   return obj.instance.exports.exported_func();
}

WebAssembly.instantiateStreaming(asm_paint_bg, importObject)
           .then(and_then);