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.

MDN Reference

Properties

Link copied to clipboard

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

Link copied to clipboard

The objectStoreNames read-only property of the 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

The version property of the IDBDatabase interface is a 64-bit integer that contains the version of the connected database.

Functions

Link copied to clipboard
fun close()

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

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

The createObjectStore() method of the The method takes the name of the store as well as a parameter object that lets you define important optional properties.

Link copied to clipboard

The deleteObjectStore() method of the the connected database, along with any indexes that reference it.

Link copied to clipboard
Link copied to clipboard
fun transaction(    storeNames: ReadonlyArray<JsString>,     mode: IDBTransactionMode = definedExternally,     options: IDBTransactionOptions = definedExternally): IDBTransaction

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