react-native-threads
react-native-threads copied to clipboard
Main thread not receiving message
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?
I have the same. Ive found, that message can be canceled because thread is null. I deleted this *if*, but it still doesn
t work(
Try changing onMessage
to onmessage