Join us online - 19th of November
Save your spot
For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.

Interface IDBRequest<T>

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.

MDN Reference

interface IDBRequest<T = any> {
    error: DOMException | null;
    onerror: ((this: IDBRequest<T>, ev: Event) => any) | null;
    onsuccess: ((this: IDBRequest<T>, ev: Event) => any) | null;
    readyState: IDBRequestReadyState;
    result: T;
    source: IDBObjectStore | IDBIndex | IDBCursor;
    transaction: IDBTransaction | null;
    addEventListener<K extends keyof IDBRequestEventMap>(
        type: K,
        listener: (this: IDBRequest<T>, ev: IDBRequestEventMap[K]) => any,
        options?: boolean | AddEventListenerOptions,
    ): void;
    addEventListener(
        type: string,
        listener: EventListenerOrEventListenerObject,
        options?: boolean | AddEventListenerOptions,
    ): void;
    dispatchEvent(event: Event): boolean;
    removeEventListener<K extends keyof IDBRequestEventMap>(
        type: K,
        listener: (this: IDBRequest<T>, ev: IDBRequestEventMap[K]) => any,
        options?: boolean | EventListenerOptions,
    ): void;
    removeEventListener(
        type: string,
        listener: EventListenerOrEventListenerObject,
        options?: boolean | EventListenerOptions,
    ): void;
}

Type Parameters

  • T = any

Hierarchy (View Summary)

Index
error: DOMException | null

The error read-only property of the IDBRequest interface returns the error in the event of an unsuccessful request.

MDN Reference

onerror: ((this: IDBRequest<T>, ev: Event) => any) | null
onsuccess: ((this: IDBRequest<T>, ev: Event) => any) | null

The readyState read-only property of the IDBRequest interface returns the state of the request.

MDN Reference

result: T

The result read-only property of the IDBRequest interface returns the result of the request.

MDN Reference

The source read-only property of the IDBRequest interface returns the source of the request, such as an Index or an object store. If no source exists (such as when calling IDBFactory.open), it returns null.

MDN Reference

transaction: IDBTransaction | null

The transaction read-only property of the IDBRequest interface returns the transaction for the request, that is, the transaction the request is being made inside.

MDN Reference

  • The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.

    MDN Reference

    Type Parameters

    Parameters

    Returns 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.

    MDN Reference

    Parameters

    Returns void

  • 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 with dispatchEvent().

    MDN Reference

    Parameters

    • event: Event

    Returns boolean

  • 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.

    MDN Reference

    Type Parameters

    Parameters

    Returns 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.

    MDN Reference

    Parameters

    Returns void

Was this helpful?