@jupyterlite


@jupyterlite / @jupyterlite/apputils / IndexedDBDataConnector

Class: IndexedDBDataConnector<T>#

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

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:21

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:55

Get default options for localForage instances

Returns#

LocalForageOptions


storage#

Get Signature#

get protected storage(): Promise<LocalForage>

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

A lazy reference to the underlying storage.

Returns#

Promise<LocalForage>

Methods#

createStorage()#

protected createStorage(): LocalForage

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

Initialize the default storage for contents.

Returns#

LocalForage


fetch()#

fetch(id): Promise<undefined | T>

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

Fetch a value from the data connector.

Parameters#

id#

string

The identifier of the value to fetch.

Returns#

Promise<undefined | T>

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:33

Initialize the data connector.

Returns#

Promise<void>


initStorage()#

protected initStorage(): Promise<void>

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

Initialize storage instance

Returns#

Promise<void>


list()#

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

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

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:127

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:139

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