new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Playwright · API reference · all subjects

worker

5 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Worker class introduction

The Worker class represents a WebWorker. A 'worker' event is emitted on the page object to signal a worker creation. A 'close' event is emitted on the worker object when the worker is gone.

Worker example JavaScript

Example of Worker usage in JavaScript: ```js page.on('worker', worker => { console.log('Worker created: ' + worker.url()); worker.on('close', worker => console.log('Worker destroyed: ' + worker.url())); }); console.log('Current workers:'); for (const worker of page.workers()) console.log(' ' + worker.url()); ```

Worker example Java

Example of Worker usage in Java: ```java page.onWorker(worker -> { System.out.println("Worker created: " + worker.url()); worker.onClose(worker1 -> System.out.println("Worker destroyed: " + worker1.url())); }); System.out.println("Current workers:"); for (Worker worker : page.workers()) System.out.println(" " + worker.url()); ```

Worker example Python

Example of Worker usage in Python: ```python def handle_worker(worker): print("worker created: " + worker.url) worker.on("close", lambda: print("worker destroyed: " + worker.url)) page.on('worker', handle_worker) print("current workers:") for worker in page.workers: print(" " + worker.url) ```

Worker example C#

Example of Worker usage in C#: ```csharp page.Worker += (_, worker) => { Console.WriteLine($"Worker created: {worker.Url}"); worker.Close += (_, _) => Console.WriteLine($"Worker closed {worker.Url}"); }; Console.WriteLine("Current Workers:"); foreach(var pageWorker in page.Workers) { Console.WriteLine($"\tWorker: {pageWorker.Url}"); } ```

Give your agent this brain