I got a web worker work perfectly on all navigator except my favorite one. "Safari". The result is totaly random. Sometime it's work, sometime not, and i really not understand why.
My code is sample, but i probably do something wrong .. Any idea ?
Main.js
function CreateWorker(){
return new Promise((resolve, reject) => {
const w = new Worker("worker.js");
w.onmessage = function (args) { alert("work fine");};
w.onerror = function(e){ alert("error");};
w.postMessage({ Size : 1280});
});
}
CreateWorker();
Worker.js
onmessage = function (args) {
postMessage({ Msg : "Received"});
}
So if i test it on multiple browser everyting work fine, but safari always give random result. Is it possible it's a cache story, or something i miss somewhere ?
Is it possible the worker is not finish to load the file, and are not ready to received the message ? If yes, is there a way to validate that the worker is ready to received a message ?
Thanks for your help.