mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-04-25 15:12:12 +00:00
23 lines
673 B
HTML
23 lines
673 B
HTML
<script src="https://cdn.jsdelivr.net/gh/AssemblyScript/binaryen.js/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>
|