All Projects → ExodusMovement → react-native-wasm

ExodusMovement / react-native-wasm

Licence: other
No description, website, or topics provided.

Programming Languages

javascript
184084 projects - #8 most used programming language
objective c
16641 projects - #2 most used programming language
python
139335 projects - #7 most used programming language
java
68154 projects - #9 most used programming language
shell
77523 projects

desired usage

A true shim for the WebAssembly global would be best, but is probably impossible, due to the async nature of communcation with WebView

A nice second best would be an almost-shim, a la:

// load
const wasmModule = await WebAssembly.instantiateStreaming('/path/to/assets/somemodule.wasm')
// use as with WebAssembly, but everything's async
const result = await wasmModule.instance.exports.doSomething('hi', { blah: 'ho' })

potential approaches:

for now, it looks like async is enough

JS only vs JS + Native-side WebView manipulation

JS-only would be cleanest, but we may need additional control over the WebView, e.g. to make it load .wasm from local assets. Still need to experiment to see if fetch('/path/to/somemodule.wasm') can be made to work

alternatives to WASM

  • emscripten
  • convert wasm to JS with binaryen's experimental wasm2js. But at this point you might as well just use emscripten to convert to asm.js in the first place

iOS nonsense

How to load WASM

Questions

  • how to load WASM in WebView?
    • fetch() from local assets (so far unsuccessful)
    • load WASM from some server - requires being online, but can maybe be cached until next app upgrade
    • inline in HTML
    • inline in main bundle, send as base64 via postMessage. This sounds slow. Monero's wasm alone is a >1MB binary.
    • load from native-side (don't know if possible)

potentially useful tools / modules / SO questions

comlink module that creates a proxy object that works across postMessage. Will need proxy-polyfill

wkwebview (not exactly what's needed but could be helpful)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].