Answer the question
In order to leave comments, you need to log in
Worker via Blob not working properly?
I am running this code
if(!!window.Worker){
if(!!window.Blob){
var bb = new Blob(["self.addEventListener('message',function(e){self.postMessage(e.data);},false);"]);
var blobURL = window.URL.createObjectURL(bb);
console.log(blobURL);
var worker = new Worker(blobURL[0]);
console.log(worker);
worker.addEventListener('message',function(e){
console.log("worker message : "+e.data);
},false);
worker.postMessage('Hello, worker!'); // Start the worker.
}else{
// fallback
}
}else{
// fallback
}
Answer the question
In order to leave comments, you need to log in
So the worker can only be an external file. Emulation won't help here.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question