react-native-threads icon indicating copy to clipboard operation
react-native-threads copied to clipboard

Main thread not receiving message

Open morganruffner opened this issue 4 years ago • 2 comments

I was able to get the worker thread to receive a message, but when it then calls self.postMessage it does not seem like the main thread is receiving it. I have declared the thread with:

mettimer = new Thread('./cameraworker.js'); mettimer.onMessage = this.handleMessage;

where handleMessage is:

handleMessage = message => { console.log('recieved message'); }

In the worker file I have:

self.onmessage = (message) => {

console.log('message received'); self.postMessage(' ');

}

Am I missing something or is this a problem with the module?

morganruffner avatar Aug 07 '20 02:08 morganruffner

I have the same. Ive found, that message can be canceled because thread is null. I deleted this *if*, but it still doesnt work(

PotrusKaterina avatar Oct 08 '20 13:10 PotrusKaterina

Try changing onMessage to onmessage

backmeupplz avatar Jan 22 '21 03:01 backmeupplz