evaluate
Evaluates JavaScript client-side, via raw content or a URL to some JavaScript code, in the browser's page environment
Usage Example:
mutation EvaluateScript {
byContent: evaluate(content: "2 + 2") {
value
}
byUrl: evaluate(url: "https://example.com/script.js") {
value
}
}
Field Definition:
evaluate(
content: String
timeout: Float
url: String
): EvaluateResponse
Arguments
evaluate.content ● String scalar
The raw script you'd like to evaluate. This code gets wrapped in an async function so you can use return at the end as well as await and other async concepts. You can return any stringified value from this function
evaluate.timeout ● Float scalar
A timeout to wait for the script to finish evaluating, overriding any defaults. Useful for async scripts that may be longer running. Default timeout is 30 seconds, or 30000.
evaluate.url ● String scalar
The URL of the script you'd like to evaluate. This code gets wrapped in an async function so you can use return at the end as well as await and other async
concepts. You can return any stringified value from this function
Type
EvaluateResponse object
Response returned after evaluating a script