Skip to content

Instantly share code, notes, and snippets.

@goofmint
Created March 21, 2019 13:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goofmint/b27c4e6caab9dda404c14b9dffc0d3f2 to your computer and use it in GitHub Desktop.
Save goofmint/b27c4e6caab9dda404c14b9dffc0d3f2 to your computer and use it in GitHub Desktop.
sayHello(index) {
const length = mem.getUint32(index,true);
const array = new Uint16Array(mem.buffer,index + 4,length);
const str = new TextDecoder('utf-16').decode(array);
console.log(`Hello ${str}, from WebAssembly!`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment