Error downloading web worker
jitenderchand1 opened this issue ยท 6 comments
jitenderchand1 commented
RichardBoyewa commented
@jitenderchand1 Whats your folder structure like?
jitenderchand1 commented
My folder structure look like.
Code in service.container.js
const worker = new Worker('worker.js');
//console.log(worker.postMessage)
worker.postMessage("start");
Code in worker.js
import { self } from 'react-native-workers';
/* get message from application. String only ! */
self.onmessage = (message) => {
}
/* post message to application. String only ! */
self.postMessage("hello from worker");
even I am getting this error when using absolute path.
const worker = new Worker('http://www.w3schools.com/html/demo_workers.js');
//console.log(worker.postMessage)
worker.postMessage("start");
jitenderchand1 commented
fixed
StellwagJo commented
Could you please explain us how you fixed this issue. I am using React-Native 0.31 and having the same issue.
RichardBoyewa commented
@StellwagJo Setting appropriate path should fix it. Let me know if u still have the problem.
StellwagJo commented
Thanks the solution with appropriate path worked for me too.