Repository navigation
Replies: 2 comments
|
What is you |
0 replies
|
@jihuayu but I want to run the function using js code, is that possible, the code works with mjs file and wasm file. import mod from './index.wasm'; // Import WASM module
export default {
async fetch(request, env, ctx) {
try {
const instance = await WebAssembly.instantiate(mod);
const wasmModule = await instance.exports.msg();
return new Response(`Success: ${wasmModule}`);
} catch (error) {
return new Response(`Error: ${error.message}`, { status: 500 });
}
}
} |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
There's
hello-wasmsample, but it seems not work correctly.Basically we can call Wasm from JavaScript via wrangler, so I did try to port this example to workerd.
I copy the
simple.wasmgenerated by wat2wasm to the same folder of README projectAnd change the
hello.jsto:But got error when running:
All reactions