mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 21:53:35 +03:00
16 lines
344 B
JavaScript
16 lines
344 B
JavaScript
|
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));
|
||
|
}
|
||
|
})();
|