Interface IDBTransaction
db: IDBDatabase;
durability: IDBTransactionDurability;
error: DOMException | null;
mode: IDBTransactionMode;
objectStoreNames: DOMStringList;
onabort: ((this: IDBTransaction, ev: Event) => any) | null;
oncomplete: ((this: IDBTransaction, ev: Event) => any) | null;
onerror: ((this: IDBTransaction, ev: Event) => any) | null;
abort(): void;
addEventListener<K extends keyof IDBTransactionEventMap>(
type: K,
listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void;
addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void;
commit(): void;
dispatchEvent(event: Event): boolean;
objectStore(name: string): IDBObjectStore;
removeEventListener<K extends keyof IDBTransactionEventMap>(
type: K,
listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void;
removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void;
}
Hierarchy
- EventTarget
- IDBTransaction
Index
Properties
Readonlydb
The db read-only property of the IDBTransaction interface returns the database connection with which this transaction is associated.
Readonlydurability
The durability read-only property of the IDBTransaction interface returns the durability hint the transaction was created with.
Readonlyerror
The IDBTransaction.error property of the IDBTransaction interface returns the type of error when there is an unsuccessful transaction.
Readonlymode
The mode read-only property of the data in the object stores in the scope of the transaction (i.e., is the mode to be read-only, or do you want to write to the object stores?) The default value is readonly.
ReadonlyobjectStoreNames
The objectStoreNames read-only property of the of IDBObjectStore objects.
onabort
oncomplete
onerror
Methods
abort
The
abort()method of the IDBTransaction interface rolls back all the changes to objects in the database associated with this transaction.Returns void
addEventListener
- addEventListener<K extends keyof IDBTransactionEventMap>(
type: K,
listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): voidThe
addEventListener()method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.Type Parameters
- K extends keyof IDBTransactionEventMap
Parameters
- type: K
- listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any
Optionaloptions: boolean | AddEventListenerOptions
Returns void
- addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): voidThe
addEventListener()method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.Parameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | AddEventListenerOptions
Returns void
commit
The
commit()method of the IDBTransaction interface commits the transaction if it is called on an active transaction.Returns void
dispatchEvent
The
dispatchEvent()method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.Parameters
- event: Event
Returns boolean
objectStore
The
objectStore()method of the added to the scope of this transaction.Parameters
- name: string
Returns IDBObjectStore
removeEventListener
- removeEventListener<K extends keyof IDBTransactionEventMap>(
type: K,
listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): voidThe
removeEventListener()method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.Type Parameters
- K extends keyof IDBTransactionEventMap
Parameters
- type: K
- listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any
Optionaloptions: boolean | EventListenerOptions
Returns void
- removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): voidThe
removeEventListener()method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.Parameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | EventListenerOptions
Returns void
The
IDBTransactioninterface of the IndexedDB API provides a static, asynchronous transaction on a database using event handler attributes.MDN Reference