Skip to content

Commit

Permalink
resolves #32 - playground.js not receiving output from the parser (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
justinwilaby committed Jun 20, 2020
1 parent 13ec382 commit 976bdee
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/playground.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@ async function runProgram() {
const linearMemory = result.instance.exports.memory;
const memBuff = Buffer.from(linearMemory.buffer, ptr, len);
const rawString = memBuff.toString();
// Note that this is low level encoded data
// See SAXParser.eventTrap for examples on how this is decoded
console.log(event, rawString);
try {
JSON.parse(rawString);
} catch (e) {
debugger;
}
}

function error_handler(error, ptr, len) {
Expand All @@ -34,6 +31,8 @@ async function runProgram() {
const wasm = fs.readFileSync(path.resolve(__dirname, '../lib/sax-wasm.wasm'));
result = await WebAssembly.instantiate(wasm, imports);
const linearMemory = result.instance.exports.memory;
result.instance.exports.parser(0b111111111111);

const document = `export class Sample {
render() {
return (
Expand All @@ -49,7 +48,6 @@ async function runProgram() {

let memBuff = new Uint8Array(linearMemory.buffer, 0, docBuff.length);
memBuff.set(docBuff, 0);
result.instance.exports.parser(0b111111111111);
result.instance.exports.write(0, memBuff.length);
}

Expand Down

0 comments on commit 976bdee

Please sign in to comment.