IDBDatabase

The IDBDatabase interface of the IndexedDB API provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that database. The interface provides the only way to get and manage versions of the database.

MDN Reference

Properties

Link copied to clipboard
open external val name: String

The name read-only property of the IDBDatabase interface is a string that contains the name of the connected database.

Link copied to clipboard
open external val objectStoreNames: DOMStringList

The objectStoreNames read-only property of the IDBDatabase interface is a DOMStringList containing a list of the names of the object stores currently in the connected database.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open external val version: UInt53

The version read-only property of the IDBDatabase interface is non-negative integer that contains the version of the connected database.

Functions

Link copied to clipboard
open external override fun close()

The close() method of the IDBDatabase interface returns immediately and closes the connection in a separate thread.

Link copied to clipboard
open external fun createObjectStore(name: String, options: IDBObjectStoreParameters = definedExternally): IDBObjectStore

The createObjectStore() method of the IDBDatabase interface creates and returns a new IDBObjectStore.

Link copied to clipboard
open external fun deleteObjectStore(name: String)

The deleteObjectStore() method of the IDBDatabase interface destroys the object store with the given name in the connected database, along with any indexes that reference it.

Link copied to clipboard
open external override fun dispatchEvent(event: Event): Boolean
Link copied to clipboard
open external fun transaction(storeNames: ReadonlyArray<JsString>, mode: IDBTransactionMode = definedExternally, options: IDBTransactionOptions = definedExternally): IDBTransaction
open external fun transaction(storeNames: String, mode: IDBTransactionMode = definedExternally, options: IDBTransactionOptions = definedExternally): IDBTransaction

The transaction method of the IDBDatabase interface immediately returns a transaction object (IDBTransaction) containing the IDBTransaction.objectStore method, which you can use to access your object store.

Link copied to clipboard
open external fun <T : Event> when(type: EventType<T>, options: ObservableEventListenerOptions?): Observable<T>