Module

Database.IndexedDB.IDBDatabase

Package
purescript-indexeddb
Repository
truqu/purescript-indexedDB

Each origin has an associated set of databases. A database has zero or more object stores which hold the data stored in the database.

#StoreName Source

type StoreName = String

Type alias for StoreName

#ObjectStoreParameters Source

type ObjectStoreParameters = { autoIncrement :: Boolean, keyPath :: KeyPath }

Options provided when creating an object store.

#close Source

close :: forall db e. IDBDatabase db => db -> Aff (idb :: IDB | e) Unit

Closes the connection once all running transactions have finished.

#createObjectStore Source

createObjectStore :: forall db e. IDBDatabase db => db -> StoreName -> ObjectStoreParameters -> Aff (idb :: IDB | e) ObjectStore

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

Throws a "InvalidStateError" DOMException if not called within an upgrade transaction

#deleteObjectStore Source

deleteObjectStore :: forall db e. IDBDatabase db => db -> StoreName -> Aff (idb :: IDB | e) ObjectStore

Deletes the object store with the given name.

Throws a "InvalidStateError" DOMException if not called within an upgrade transaction.

#transaction Source

transaction :: forall db e. IDBDatabase db => db -> Array StoreName -> TransactionMode -> Aff (idb :: IDB | e) Transaction

Returns a new transaction with the given mode (ReadOnly|ReadWrite) and scope which in the form of an array of object store names.

#name Source

name :: Database -> String

Returns the name of the database.

#objectStoreNames Source

objectStoreNames :: Database -> Array String

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

#version Source

version :: Database -> Int

Returns the version of the database.

#onAbort Source

onAbort :: forall e' e. Database -> Eff e' Unit -> Aff (idb :: IDB | e) Unit

Event handler for the abort event.

#onClose Source

onClose :: forall e' e. Database -> Eff e' Unit -> Aff (idb :: IDB | e) Unit

Event handler for the close event.

#onError Source

onError :: forall e' e. Database -> (Error -> Eff e' Unit) -> Aff (idb :: IDB | e) Unit

Event handler for the error event.

#onVersionChange Source

onVersionChange :: forall e' e. Database -> ({ newVersion :: Int, oldVersion :: Int } -> Eff e' Unit) -> Aff (idb :: IDB | e) Unit

Event handler for the versionchange event.