IDBDatabase

sealed external class IDBDatabase : EventTarget(source)

This IndexedDB API interface 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

Returns the name of the database.

Link copied to clipboard

Returns a list of the names of object stores in the database.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Returns the version of the database.

Functions

Link copied to clipboard
fun close()

Closes the connection once all running transactions have finished.

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

Creates a new object store with the given name and options and returns a new IDBObjectStore.

Link copied to clipboard

Deletes the object store with the given name.

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

fun transaction(storeNames: String, mode: IDBTransactionMode = definedExternally, options: IDBTransactionOptions = definedExternally): IDBTransaction

Returns a new transaction with the given mode ("readonly" or "readwrite") and scope which can be a single object store name or an array of names.