2018-12-07 19:41:02 +01:00
|
|
|
<script src="https://cdn.jsdelivr.net/gh/AssemblyScript/binaryen.js/index.js"></script>
|
2018-04-01 23:46:41 +02:00
|
|
|
<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>
|