Home Reference Source Test
public interface | source

IJungleDB

Direct Implemented:

This is the main interface of the JungleDB.

Static Method Summary

Static Public Methods
public static abstract

commitCombined(tx1: Transaction | CombinedTransaction, tx2: Transaction, txs: ...Transaction): Promise<boolean>

Is used to commit multiple transactions atomically.

public static abstract

Creates a volatile object store (non-persistent).

Member Summary

Public Members
public get

connected: boolean

Method Summary

Public Methods
public abstract

close(): Promise

Closes the database connection.

public abstract

connect(): Promise

Connects to the indexedDB.

public abstract

createObjectStore(tableName: string, options: ObjectStoreConfig): IObjectStore

Creates a new object store (and allows to access it).

public abstract

deleteObjectStore(tableName: string, options: function(oldVersion: number, newVersion: number): boolean})

Deletes an object store.

public abstract

async destroy(): Promise

Fully deletes the database.

public abstract

getObjectStore(tableName: string): ObjectStore

Returns the ObjectStore object for a given table name.

Static Public Methods

public static abstract commitCombined(tx1: Transaction | CombinedTransaction, tx2: Transaction, txs: ...Transaction): Promise<boolean> source

Is used to commit multiple transactions atomically. This guarantees that either all transactions are written or none. The method takes a list of transactions (at least two transactions). If the commit was successful, the method returns true, and false otherwise.

Params:

NameTypeAttributeDescription
tx1 Transaction | CombinedTransaction

The first transaction (a CombinedTransaction object is only used internally).

tx2 Transaction

The second transaction.

txs ...Transaction

A list of further transactions to commit together.

Return:

Promise<boolean>

A promise of the success outcome.

public static abstract createVolatileObjectStore(options: {codec: ?ICodec}): ObjectStore source

Creates a volatile object store (non-persistent).

Params:

NameTypeAttributeDescription
options {codec: ?ICodec}
  • optional

An options object.

Return:

ObjectStore

Public Members

public get connected: boolean source

Public Methods

public abstract close(): Promise source

Closes the database connection.

Return:

Promise

The promise resolves after closing the database.

public abstract connect(): Promise source

Connects to the indexedDB.

Return:

Promise

A promise resolving on successful connection.

public abstract createObjectStore(tableName: string, options: ObjectStoreConfig): IObjectStore source

Creates a new object store (and allows to access it). This method always has to be called before connecting to the database. If it is not called, the object store will not be accessible afterwards. If a call is newly introduced, but the database version did not change, the table does not exist yet.

Params:

NameTypeAttributeDescription
tableName string

The name of the object store.

options ObjectStoreConfig
  • optional

An options object.

Return:

IObjectStore

public abstract deleteObjectStore(tableName: string, options: function(oldVersion: number, newVersion: number): boolean}) source

Deletes an object store. This method has to be called before connecting to the database.

Params:

NameTypeAttributeDescription
tableName string
options function(oldVersion: number, newVersion: number): boolean}
  • optional

public abstract async destroy(): Promise source

Fully deletes the database.

Return:

Promise

The promise resolves after deleting the database.

public abstract getObjectStore(tableName: string): ObjectStore source

Returns the ObjectStore object for a given table name.

Params:

NameTypeAttributeDescription
tableName string

The table name to access.

Return:

ObjectStore

The ObjectStore object.