Reputation: 19
I can't post wasm.instance.exports object to and from WebWorkers. Any help would be appreciated.
Upvotes: 1
Views: 312
Reputation: 70160
The messages sent via the postMessage API must be serializable. The exports from a WebAssembly module are functions (and tables, memory etc...) exported by your compiled module. None of these are serializable.
In order to invoke these exported functions, you’ll have to do it indirectly, i.e. post a message that describes which function to export, and the parameters to supply.
Upvotes: 0