Every method for making asynchronous requests returns an [IDBRequest](#idbrequest)
object that communicates back to the requesting application through events. This design means that any number of requests can be active on any at a time.
In the following example, we open a asynchronously. Various event handlers are registered for responding to various situations.
request . [result](#dom-idbrequest-result)
When a request is completed, returns the result, or undefined
if the request failed. Throws a “[InvalidStateError](https://heycam.github.io/webidl/#invalidstateerror)
“ [DOMException](https://heycam.github.io/webidl/#idl-DOMException)
if the request is still pending.
request . [error](#dom-idbrequest-error)
When a request is completed, returns the (a [DOMException](https://heycam.github.io/webidl/#idl-DOMException)
), or null if the request succeeded. Throws a “[InvalidStateError](https://heycam.github.io/webidl/#invalidstateerror)
“ [DOMException](https://heycam.github.io/webidl/#idl-DOMException)
if the request is still pending.
Returns the [IDBObjectStore](#idbobjectstore)
, [IDBIndex](#idbindex)
, or [IDBCursor](#idbcursor)
the request was made against, or null if it was an open request.
request .
Returns the [IDBTransaction](#idbtransaction)
the request was made within. If this as an , then it returns an upgrade transaction while it is running, or null otherwise.
request . [readyState](#dom-idbrequest-readystate)
Returns ["pending"](#dom-idbrequestreadystate-pending)
until a request is complete, then returns ["done"](#dom-idbrequestreadystate-done)
.
The result
attribute’s getter must an “[InvalidStateError](https://heycam.github.io/webidl/#invalidstateerror)
“ [DOMException](https://heycam.github.io/webidl/#idl-DOMException)
if this‘s is false. Otherwise, the attribute’s getter must return this‘s , or undefined if the request resulted in an error.
The error
attribute’s getter must throw an “[InvalidStateError](https://heycam.github.io/webidl/#invalidstateerror)
“ [DOMException](https://heycam.github.io/webidl/#idl-DOMException)
if ‘s done flag is false. Otherwise, the attribute’s getter must return ‘s error, or null if no error occurred.
The transaction
attribute’s getter must return ‘s transaction. This property can be null for certain requests, such as for returned from [open()](#dom-idbfactory-open)
.
The attribute’s getter must return ["pending"](#dom-idbrequestreadystate-pending)
if this‘s is false, and ["done"](#dom-idbrequestreadystate-done)
otherwise.
The onsuccess
attribute is the event handler for the success
event.
The onerror
attribute is the event handler for the event.
Methods on [IDBDatabase](#idbdatabase)
that return a open request use an extended interface to allow listening to the and upgradeneeded
events.
The onblocked
attribute is the event handler for the event.
The onupgradeneeded
attribute is the event handler for the upgradeneeded
event.