Skip to main content
Module

x/evt/lib/types/lib.dom.ts>IDBRequest

💧EventEmitter's typesafe replacement
Go to Latest
interface IDBRequest
implements EventTarget
import { type IDBRequest } from "https://deno.land/x/evt@v2.4.3/lib/types/lib.dom.ts";

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.

Type Parameters

optional
T = any

Properties

readonly
error: DOMException | null

When a request is completed, returns the error (a DOMException), or null if the request succeeded. Throws a "InvalidStateError" DOMException if the request is still pending.

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

Returns "pending" until a request is complete, then returns "done".

readonly
result: T

When a request is completed, returns the result, or undefined if the request failed. Throws a "InvalidStateError" DOMException if the request is still pending.

readonly
source: IDBObjectStore | IDBIndex | IDBCursor

Returns the IDBObjectStore, IDBIndex, or IDBCursor the request was made against, or null if is was an open request.

readonly
transaction: IDBTransaction | null

Returns the IDBTransaction the request was made within. If this as an open request, then it returns an upgrade transaction while it is running, or null otherwise.

Methods

addEventListener<K extends keyof IDBRequestEventMap>(
type: K,
listener: (this: IDBRequest<T>, ev: IDBRequestEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void
addEventListener(
type: string,
options?: boolean | AddEventListenerOptions,
): void
removeEventListener<K extends keyof IDBRequestEventMap>(
type: K,
listener: (this: IDBRequest<T>, ev: IDBRequestEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void
removeEventListener(
type: string,
options?: boolean | EventListenerOptions,
): void