forked from AssemblyScript/assemblyscript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibm.html
More file actions
22 lines (22 loc) · 671 Bytes
/
libm.html
File metadata and controls
22 lines (22 loc) · 671 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<script src="https://rawgit.com/AssemblyScript/binaryen.js/master/index.js"></script>
<script>
var libm;
// fetch("../compiler/std/libm.optimized.wat") // doesn't work: too large?
// .then(str => Binaryen.parseText(str))
// .then(module => module.emitBinary())
fetch("libm.wasm")
.then(res => res.arrayBuffer())
.then(buf => WebAssembly.instantiate(buf, {}))
.then(module => {
libm = module.instance.exports;
Object.keys(libm).forEach(key => {
var val = libm[key];
if (typeof val === "function") {
console.log("libm." + key + "(...)");
} else {
console.log("libm." + key + " = " + val);
}
});
})
.catch(err => { throw err; });
</script>