puppeteer/docs/api/puppeteer.webworker.evaluatehandle.md
dependabot[bot] 93e9acc410
chore(deps-dev): Bump the dev-dependencies group with 3 updates (#12101)
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>
2024-03-20 15:03:14 +00:00

1.3 KiB

sidebar_label
WebWorker.evaluateHandle

WebWorker.evaluateHandle() method

Evaluates a given function in the worker.

Signature:

class WebWorker {
  evaluateHandle<
    Params extends unknown[],
    Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
  >(
    func: Func | string,
    ...args: Params
  ): Promise<HandleFor<Awaited<ReturnType<Func>>>>;
}

Parameters

Parameter

Type

Description

func

Func | string

Function to be evaluated.

args

Params

Arguments to pass into func.

**Returns:**

Promise<HandleFor<Awaited<ReturnType<Func>>>>

A handle to the return value of func.

Remarks

If the given function returns a promise, evaluate will wait for the promise to resolve.

In general, you should use evaluateHandle if evaluate cannot serialize the return value properly or you need a mutable handle to the return object.