17 lines
497 B
JavaScript
17 lines
497 B
JavaScript
|
(function (){
|
||
|
let bytes = new Uint8Array([
|
||
|
0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00,
|
||
|
0x01, 0x07, 0x01, 0x60, 0x02, 0x7f, 0x7f, 0x01,
|
||
|
0x7f, 0x03, 0x02, 0x01, 0x00, 0x07, 0x07, 0x01,
|
||
|
0x03, 0x73, 0x75, 0x6d, 0x00, 0x00, 0x0a, 0x0a,
|
||
|
0x01, 0x08, 0x00, 0x20, 0x00, 0x20, 0x01, 0x6a,
|
||
|
0x0f, 0x0b
|
||
|
]);
|
||
|
|
||
|
console.log(bytes);
|
||
|
let mod = new WebAssembly.Module(bytes);
|
||
|
let instance = new WebAssembly.Instance(mod, {});
|
||
|
console.log(instance.exports);
|
||
|
return instance.exports.sum(2020, 1);
|
||
|
}());
|