postMessage is not working
jitenderchand1 opened this issue · 0 comments
jitenderchand1 commented
postMessage method is not working from parent file. Worker.js is not receiving onmessage event
Parent script
const worker = new Worker('src/containers/worker.js');
worker.onmessage = (message)=>{
console.log('asfasfafasfsafa')
}
worker.postMessage("start");
Worker script
import { self } from 'react-native-workers';
/* get message from application. String only ! */
self.onmessage = (message) => {
console.log('i m worker' + message);
}
/* post message to application. String only ! */
self.postMessage("hello from worker");