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

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.greet();
}

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