IDBRequest extension type
The IDBRequest
interface of the IndexedDB API provides access to
results of asynchronous requests to databases and database objects using
event handler attributes. Each reading and writing operation on a database
is done using a request.
The request object does not initially contain any information about the
result of the operation, but once information becomes available, an event is
fired on the request, and the information becomes available through the
properties of the IDBRequest
instance.
All asynchronous operations immediately return an IDBRequest instance.
Each request has a readyState
that is set to the 'pending'
state; this
changes to 'done'
when the request is completed or fails. When the state
is set to done
, every request returns a result
and an error
, and an
event is fired on the request. When the state is still pending
, any
attempt to access the result
or error
raises an InvalidStateError
exception.
In plain words, all asynchronous methods return a request object. If the
request has been completed successfully, the result is made available
through the result
property and an event indicating success is fired at
the request (IDBRequest.success_event
). If an error occurs while
performing the operation, the exception is made available through the
error
property and an error event is fired (IDBRequest.error_event
).
The interface IDBOpenDBRequest is derived from IDBRequest
.
- on
- Implemented types
- Implementers
Properties
- error → DOMException?
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- onerror ↔ EventHandler?
-
getter/setter pair
- onsuccess ↔ EventHandler?
-
getter/setter pair
- readyState → IDBRequestReadyState
-
no setter
- result → JSAny?
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- source → JSObject?
-
no setter
- transaction → IDBTransaction?
-
no setter
Methods
-
addEventListener(
String type, EventListener? callback, [JSAny options]) → void -
The
addEventListener()
method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.inherited -
dispatchEvent(
Event event) → bool -
The
dispatchEvent()
method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually withdispatchEvent()
.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeEventListener(
String type, EventListener? callback, [JSAny options]) → void -
The
removeEventListener()
method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited