puppeteer/test/assets/worker/worker.js

17 lines
350 B
JavaScript
Raw Permalink Normal View History

console.log('hello from the worker');
function workerFunction() {
return 'worker function result';
}
2020-05-07 10:54:55 +00:00
self.addEventListener('message', (event) => {
console.log('got this data: ' + event.data);
});
2020-05-07 10:54:55 +00:00
(async function () {
while (true) {
self.postMessage(workerFunction.toString());
2020-05-07 10:54:55 +00:00
await new Promise((x) => setTimeout(x, 100));
}
2020-05-07 10:54:55 +00:00
})();