1. I can successfully open mycode.js (created by emscripten) in my html page and use the wasm by attaching a function to Module.onRuntimeInitialized
2. I wish to do the above activity in a web worker (instead of calling mycode.js in script tags in my html page)
so I wrote a ww.js file and called
var w = new Worker("ww.js");
in ww.js I have this code
importScripts('mycode.js');
Module.onRuntimeInitialized = function() {
console.log('mycode module runtime Initialized');
}
I am getting errors in the console.
Uncaught (in promise) RuntimeError: Aborted(CompileError: WebAssembly.instantiate(): expected magic word 00 61 73 6d, found 3c 21 44 4f @+0)
So my question is why the mycode.js "works" from the script tags and does not work from the web worker.
Please help me .
(You must have noticed that I am a newbie !!!)
Or point me to any example code to achieve the above.
Thanks in advance.