Open Genhain opened 5 years ago
I have the same issue!! Did you manage to find a solution @Genhain?
@vishalnarkhede @Genhain did you find the solution for this issue?
@vishalnarkhede @Genhain
When the callback gets called from listeningDeviceEventEmitter.addListener('ThreadMessage', (message) => {
Doing a console of self it seems that onmessage is null thats why Im assuming self.onmessage is never called
{ onmessage: null, postMessage: [Function: postMessage] }
Can someone tell if this is true?
In my case:
// main
// start a new react native JS process
const thread = new Thread('thread.js');
// send a message, strings only
thread.postMessage('run');
// thread
// listen for messages
self.onmessage = (message) => {
console.log(message);
};
However, no message is received in the Thread.js. My react-native version: 0.63.2
I had to manually install as automatic would never run. however i eventually got it running and have placed breakpoints in XCode and confirm that
postmessage
is being called but the said message never reaches myworker.thread.js
I also had to specify an absolute path for it to work like so
otherwise it would say the file did not exist.
and here is my worker thread.js