You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
372 B
18 lines
372 B
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();
|