feat(webworker): expose WebWorker.client (#10042)

Co-authored-by: Alex Rudenko <alexrudenko@chromium.org>
This commit is contained in:
zeeker999 2023-04-19 17:00:08 +08:00 committed by GitHub
parent 28154eff6f
commit c12512822a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -36,6 +36,12 @@ for (const worker of page.workers()) {
}
```
## Properties
| Property | Modifiers | Type | Description |
| -------- | --------------------- | --------------------------------------- | ------------------------------------------------ |
| client | <code>readonly</code> | [CDPSession](./puppeteer.cdpsession.md) | The CDP session client the WebWorker belongs to. |
## Methods
| Method | Modifiers | Description |

View File

@ -122,6 +122,13 @@ export class WebWorker extends EventEmitter {
return this.#url;
}
/**
* The CDP session client the WebWorker belongs to.
*/
get client(): CDPSession {
return this.#client;
}
/**
* If the function passed to the `worker.evaluate` returns a Promise, then
* `worker.evaluate` would wait for the promise to resolve and return its