← Back to Runtime domain

Runtime.awaitPromise

Add handler to promise with given promise object id.

Domain: Runtime stable

Parameters

NameTypeDescription
promiseObjectIdRemoteObjectIdIdentifier of the promise.
returnByValue (optional)booleanWhether the result is expected to be a JSON object that should be sent by value.
generatePreview (optional)booleanWhether preview should be generated for the result.

Returns

NameTypeDescription
resultRemoteObjectPromise result. Will contain rejected value if promise was rejected.
exceptionDetailsExceptionDetailsException 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"}