var i = 0; console.log("Starting worker") onmessage = (ev) => { console.log(`Worker received data ${ev.data}`) const data = JSON.parse(ev.data) postMessage(JSON.stringify({ data: data.data * 2 })) } // function timedCount() { // i = i + 1; // postMessage(JSON.stringify({ data: i })); // setTimeout("timedCount()", 2000); // } // timedCount();