- Notifications
You must be signed in to change notification settings - Fork 258
/
Copy pathtable2.html
33 lines (27 loc) · 634 Bytes
/
table2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!doctype html>
<html>
<head>
<metacharset="utf-8">
<title>Another WASM table example</title>
</head>
<body>
<script>
consttbl=newWebAssembly.Table({
initial: 2,
element: "anyfunc"
});
console.log(tbl.length);
console.log(tbl.get(0));
console.log(tbl.get(1));
constimportObject={
js: { tbl }
};
WebAssembly.instantiateStreaming(fetch("table2.wasm"),importObject)
.then(obj=>{
console.log(tbl.length);
console.log(tbl.get(0)());
console.log(tbl.get(1)());
});
</script>
</body>
</html>