33 lines
1.5 KiB
HTML
33 lines
1.5 KiB
HTML
|
|
<!DOCTYPE html>
|
||
|
|
<script src="../include.js"></script>
|
||
|
|
<script>
|
||
|
|
asyncTest(async (done) => {
|
||
|
|
const wasmBytes = new Uint8Array([
|
||
|
|
0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00,
|
||
|
|
0x01, 0x07, 0x01, 0x60, 0x02, 0x7f, 0x7f, 0x01, 0x7f,
|
||
|
|
0x03, 0x02, 0x01, 0x00,
|
||
|
|
0x07, 0x1d, 0x01, 0x19,
|
||
|
|
0x73, 0x71, 0x6c, 0x69, 0x74, 0x65, 0x33, 0x5f,
|
||
|
|
0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74,
|
||
|
|
0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74,
|
||
|
|
0x00, 0x00,
|
||
|
|
0x0a, 0x06, 0x01, 0x04, 0x00, 0x20, 0x00, 0x0b,
|
||
|
|
]);
|
||
|
|
|
||
|
|
const { instance } = await WebAssembly.instantiate(wasmBytes);
|
||
|
|
const fn = instance.exports.sqlite3_aggregate_context;
|
||
|
|
const exportName = Object.getOwnPropertyNames(instance.exports)[0];
|
||
|
|
const lengthDescriptor = Object.getOwnPropertyDescriptor(fn, "length");
|
||
|
|
const nameDescriptor = Object.getOwnPropertyDescriptor(fn, "name");
|
||
|
|
|
||
|
|
println(`length: ${fn.length}`);
|
||
|
|
println(`name: ${fn.name}`);
|
||
|
|
println(`export name: ${exportName}`);
|
||
|
|
println(`length descriptor: writable=${lengthDescriptor.writable}, enumerable=${lengthDescriptor.enumerable}, configurable=${lengthDescriptor.configurable}`);
|
||
|
|
println(`name descriptor: writable=${nameDescriptor.writable}, enumerable=${nameDescriptor.enumerable}, configurable=${nameDescriptor.configurable}`);
|
||
|
|
println(`call result: ${fn(42, 7)}`);
|
||
|
|
|
||
|
|
done();
|
||
|
|
});
|
||
|
|
</script>
|