@jupyterlite


@jupyterlite / @jupyterlite/apputils / IndexedDBDataConnector

Class: IndexedDBDataConnector<T>#

Defined in: packages/apputils/src/statedb.ts:18

A StateDB data connector backed by IndexedDB

Extended by#

Type Parameters#

T#

T

Implements#

  • IDataConnector<T>

Constructors#

Constructor#

new IndexedDBDataConnector<T>(options): IndexedDBDataConnector<T>

Defined in: packages/apputils/src/statedb.ts:24

Construct a new IndexedDBDataConnector.

Parameters#

options#

IOptions

The options for the data connector.

Returns#

IndexedDBDataConnector<T>

Accessors#

defaultStorageOptions#

Get Signature#

get protected defaultStorageOptions(): LocalForageOptions

Defined in: packages/apputils/src/statedb.ts:58

Get default options for localForage instances

Returns#

LocalForageOptions


storage#

Get Signature#

get protected storage(): Promise<LocalForage>

Defined in: packages/apputils/src/statedb.ts:44

A lazy reference to the underlying storage.

Returns#

Promise<LocalForage>

Methods#

createStorage()#

protected createStorage(): LocalForage

Defined in: packages/apputils/src/statedb.ts:72

Initialize the default storage for contents.

Returns#

LocalForage


fetch()#

fetch(id): Promise<T | undefined>

Defined in: packages/apputils/src/statedb.ts:87

Fetch a value from the data connector.

Parameters#

id#

string

The identifier of the value to fetch.

Returns#

Promise<T | undefined>

A promise that resolves with the fetched value, or undefined if not found.

Implementation of#

IDataConnector.fetch


initialize()#

initialize(): Promise<void>

Defined in: packages/apputils/src/statedb.ts:36

Initialize the data connector.

Returns#

Promise<void>


initStorage()#

protected initStorage(): Promise<void>

Defined in: packages/apputils/src/statedb.ts:51

Initialize storage instance

Returns#

Promise<void>


list()#

list(namespace): Promise<{ ids: string[]; values: T[]; }>

Defined in: packages/apputils/src/statedb.ts:99

List all values in a namespace.

Parameters#

namespace#

string = ''

The namespace to list values from. Defaults to ‘’.

Returns#

Promise<{ ids: string[]; values: T[]; }>

A promise that resolves with the list of IDs and values.

Implementation of#

IDataConnector.list


remove()#

remove(id): Promise<void>

Defined in: packages/apputils/src/statedb.ts:130

Remove a value from the data connector.

Parameters#

id#

string

The identifier of the value to remove.

Returns#

Promise<void>

A promise that resolves when the value is removed.

Implementation of#

IDataConnector.remove


save()#

save(id, value): Promise<void>

Defined in: packages/apputils/src/statedb.ts:142

Save a value to the data connector.

Parameters#

id#

string

The identifier of the value to save.

value#

T

The value to save.

Returns#

Promise<void>

A promise that resolves when the value is saved.

Implementation of#

IDataConnector.save