Skip to content

How to show a WASM GUI in tauri (with Next.js) #5231

Answered by FabianLars
wangxiaochuTHU asked this question in Q&A
Discussion options

You must be logged in to vote

The second example looks almost correct i think. I did basically the same but without as-bind (which is for assemblyscript?).
iirc it was something like this

// The file's location is `/public/whatever.wasm`. The public folder mechanism may differ depending on the frontend stack.
const response = await fetch('/whatever.wasm');
const bytes = await response.arrayBuffer();
const { module, instance } = await WebAssembly.instantiate(bytes);

const add = instance.exports.add as CallableFunction;
console.log(add(12, 34));

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@wangxiaochuTHU
Comment options

@FabianLars
Comment options

@wangxiaochuTHU
Comment options

Answer selected by wangxiaochuTHU
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants