mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
93e9acc410
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Nikolay Vitkov <nvitkov@chromium.org>
76 lines
1.3 KiB
Markdown
76 lines
1.3 KiB
Markdown
---
|
|
sidebar_label: WebWorker.evaluateHandle
|
|
---
|
|
|
|
# WebWorker.evaluateHandle() method
|
|
|
|
Evaluates a given function in the [worker](./puppeteer.webworker.md).
|
|
|
|
#### Signature:
|
|
|
|
```typescript
|
|
class WebWorker {
|
|
evaluateHandle<
|
|
Params extends unknown[],
|
|
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
|
>(
|
|
func: Func | string,
|
|
...args: Params
|
|
): Promise<HandleFor<Awaited<ReturnType<Func>>>>;
|
|
}
|
|
```
|
|
|
|
## Parameters
|
|
|
|
<table><thead><tr><th>
|
|
|
|
Parameter
|
|
|
|
</th><th>
|
|
|
|
Type
|
|
|
|
</th><th>
|
|
|
|
Description
|
|
|
|
</th></tr></thead>
|
|
<tbody><tr><td>
|
|
|
|
func
|
|
|
|
</td><td>
|
|
|
|
Func \| string
|
|
|
|
</td><td>
|
|
|
|
Function to be evaluated.
|
|
|
|
</td></tr>
|
|
<tr><td>
|
|
|
|
args
|
|
|
|
</td><td>
|
|
|
|
Params
|
|
|
|
</td><td>
|
|
|
|
Arguments to pass into `func`.
|
|
|
|
</td></tr>
|
|
</tbody></table>
|
|
**Returns:**
|
|
|
|
Promise<[HandleFor](./puppeteer.handlefor.md)<Awaited<ReturnType<Func>>>>
|
|
|
|
A [handle](./puppeteer.jshandle.md) to the return value of `func`.
|
|
|
|
## Remarks
|
|
|
|
If the given function returns a promise, [evaluate](./puppeteer.webworker.evaluate.md) will wait for the promise to resolve.
|
|
|
|
In general, you should use [evaluateHandle](./puppeteer.webworker.evaluatehandle.md) if [evaluate](./puppeteer.webworker.evaluate.md) cannot serialize the return value properly or you need a mutable [handle](./puppeteer.jshandle.md) to the return object.
|