blob: 0626f13e58d704a1890c6de15b0595f59c19de77 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
console.log('hello from the worker');
function workerFunction() {
return 'worker function result';
}
self.addEventListener('message', (event) => {
console.log('got this data: ' + event.data);
});
(async function () {
while (true) {
self.postMessage(workerFunction.toString());
await new Promise((x) => setTimeout(x, 100));
}
})();
|