Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Store<DBSchema, TxStoreNames, StoreName>

A wrapper for an IndexedDB store.

Stores are semantically similar to tables in other databases.

Type parameters

Hierarchy

  • Store

Index

Constructors

Properties

Methods

Constructors

constructor

  • new Store(store: IDBPObjectStore<DBSchema, TxStoreNames, StoreName>): Store

Properties

name

name: StoreName

The name of the store.

Methods

add

  • Adds a value to the store.

    Throws if the store already has a value for the given key.

    Parameters

    Returns Promise<StoreKey<DBSchema, StoreName>>

createIndex

  • createIndex<IndexName>(name: IndexName, keyPath: string | string[], options?: IDBIndexParameters): IDBPIndex<DBSchema, TxStoreNames, StoreName, IndexName>
  • Creates a new index for the store.

    This should only be called during an Upgrade.

    Type parameters

    • IndexName: IndexNames<DBSchema, StoreName>

    Parameters

    • name: IndexName
    • keyPath: string | string[]
    • Optional options: IDBIndexParameters

    Returns IDBPIndex<DBSchema, TxStoreNames, StoreName, IndexName>

delete

  • delete(key: StoreKey<DBSchema, StoreName>): Promise<void>
  • Deletes the record matching the given key in the store.

    Parameters

    Returns Promise<void>

get

  • get(key: StoreKey<DBSchema, StoreName>): Promise<StoreValue<DBSchema, StoreName> | undefined>
  • Retrieves the value matching the given key in the store, or undefined if there is no value for that key.

    Parameters

    Returns Promise<StoreValue<DBSchema, StoreName> | undefined>

put

Generated using TypeDoc