← Back to Runtime domain
Runtime.awaitPromise
Add handler to promise with given promise object id.
Domain: Runtime
stable
Parameters
| Name | Type | Description |
promiseObjectId | RemoteObjectId | Identifier of the promise. |
returnByValue (optional) | boolean | Whether the result is expected to be a JSON object that should be sent by value. |
generatePreview (optional) | boolean | Whether preview should be generated for the result. |
Returns
| Name | Type | Description |
result | RemoteObject | Promise result. Will contain rejected value if promise was rejected. |
exceptionDetails | ExceptionDetails | Exception details if stack strace is available. |
Example Request
{
"id": 1,
"method": "Runtime.awaitPromise",
"params": {
"promiseObjectId": "promiseObjectId-value"
}
}
Example Response
{
"id": 1,
"result": {
"result": {
"type": "string",
"value": "Example Domain"
},
"exceptionDetails": "exceptionDetails-value"
}
}
Usage in Node.js
const result = await send('Runtime.awaitPromise', {"promiseObjectId": "promiseObjectId-value"});
console.log(result);
// {"result": {"type": "string", "value": "Example Domain"}, "exceptionDetails": "exceptionDetails-value"}