Skip to content

Commit 64a5d69

Browse files
committed
Make it better
1 parent c71e9ed commit 64a5d69

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/assembly/as-bind.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ export const __asbind_I32ArrayArray_ID = idof<Array<Array<i32>>>();
3232
export const __asbind_I64ArrayArray_ID = idof<Array<Array<i64>>>();
3333
export const __asbind_StringArrayArray_ID = idof<Array<Array<string>>>();
3434
export const __asbind_BoolArrayArray_ID = idof<Array<Array<bool>>>();
35+
36+
// As-Bind type data
37+
export const __asbind_type_data: string = "";

read_data.js renamed to read_type_data.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ const fs = require("fs/promises");
22

33
async function main() {
44
const b = await fs.readFile(process.argv[2]);
5-
const { instance } = await WebAssembly.instantiate(b);
5+
const { instance } = await WebAssembly.instantiate(b, {
6+
env: { abort() {} }
7+
});
68
const ptr = instance.exports.__asbind_type_data.value;
79
const dv = new DataView(instance.exports.memory.buffer);
810
const strLen = dv.getUint32(ptr - 4, true);
@@ -13,5 +15,7 @@ async function main() {
1315
);
1416
const str = new TextDecoder("utf-16le").decode(strView);
1517
console.log({ str });
18+
const data = JSON.parse(str);
19+
console.log(JSON.stringify(data, null, 2));
1620
}
1721
main();

0 commit comments

Comments
 (0)