Home

IDBRequest

IDBRequest is a JavaScript interface in the IndexedDB API that represents an asynchronous operation request. It is the generic request object returned by many operations on IndexedDB objects, including methods on IDBDatabase, IDBObjectStore, and IDBIndex such as add, put, get, delete, clear, and cursor operations. It is also used by the initial open request when opening a database.

The IDBRequest object exposes several properties. readyState indicates whether the operation is still pending or has

IDBRequest implements the EventTarget interface and provides the event handlers onsuccess and onerror to respond to

IDBOpenDBRequest is a specialized subtype of IDBRequest used for opening databases, which may expose additional events

completed,
with
possible
values
of
"pending"
or
"done".
result
holds
the
outcome
of
the
operation
and
is
available
when
the
request
completes
successfully.
error
contains
a
DOMException
describing
any
failure
that
occurred
during
the
operation.
The
source
property
refers
to
the
object
that
initiated
the
request,
such
as
an
IDBDatabase,
an
IDBObjectStore,
or
an
IDBIndex.
completion
or
failure.
Developers
may
also
attach
listeners
with
addEventListener
for
the
"success"
and
"error"
events.
When
a
request
completes
successfully,
the
result
property
contains
the
data
produced
by
the
operation
(for
example,
a
retrieved
value
or
a
generated
key
for
add).
If
an
error
occurs,
the
error
property
contains
the
corresponding
exception.
such
as
blocked.
Overall,
IDBRequest
serves
as
the
core
mechanism
for
handling
asynchronous
outcomes
in
IndexedDB
operations.