mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
93fe2b57d6
This adds `page.workers()`, and two events `workercreated` and `workerdestroyed`. It also forwards logs from a worker into the page `console` event. Only dedicated workers are supported for now, ServiceWorkers will probably work differently because they aren't necessarily associated with a single page. Fixes #2350.
14 lines
259 B
HTML
14 lines
259 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Worker test</title>
|
|
</head>
|
|
<body>
|
|
<script>
|
|
var worker = new Worker('worker.js');
|
|
worker.onmessage = function(message) {
|
|
console.log(message.data);
|
|
};
|
|
</script>
|
|
</body>
|
|
</html> |