react-native-webassembly
react-native-webassembly copied to clipboard
Request for Adding the "compile" function support in "react-native-webassembly"
Issue Description
I am trying to rebuild ffjavascript to run on React Native, and I need the compile function to be supported in react-native-webassembly.
Currently, the WebAssembly in browser engine supports the compile function, which accepts a bytes parameter and returns a Promise<Module>.
function compile(bytes: BufferSource): Promise<Module>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/compileStreaming) */
I would like to request support for this function in react-native-webassembly to replace the following code in my project:
// threadman.js
import * as WebAssembly from "react-native-webassembly";
...
export default async function buildThreadManager(wasm, singleThread) {
const tm = new ThreadManager();
tm.memory = new WebAssembly.Memory({ initial: MEM_SIZE });
// This line uses the compile function
const wasmModule = await WebAssembly.compile(wasm.code);
tm.instance = await WebAssembly.instantiate(wasmModule, {
env: {
memory: tm.memory,
},
});
}
Thank you so much! 🤩
Hey, thanks for reaching out.
Interesting. Um. Hm. Yeah we can probably do this.
Has this feature made any progress