Skip to content

Sys.Idb

Sys.Idb is a ready-made key-value store in the End user’s browser, kept in the IndexedDB database lowgile in its object store lowgile. Values stay in that browser, survive page reloads and closing the browser, and are not sent to the server. The database is opened on first use.

Caution

Lowgile keeps its own data in the same store, including the signed-in user and the session’s refresh token. Don’t write or delete keys that start with Lowgile_ or __.

For your own databases and object stores, use Sys.Storage.

Availability: Client

put(key: IDBValidKey, value: any): Promise<IDBValidKey>;

Stores a value under a key, replacing any value already stored under it, and resolves with the key.

ParameterTypeDescription
keyIDBValidKeyThe key: a string, number, Date, binary data, or an array of these.
valueanyThe value to store. It must be storable by the browser’s structured clone algorithm: plain data, arrays, Date, Blob and similar, but not functions. Class instances are stored as plain objects.

Returns: Promise<IDBValidKey> · Availability: Client

get<T = any>(key: IDBValidKey): Promise<T>;

Returns the value stored under a key, or undefined if there is none.

ParameterTypeDescription
keyIDBValidKeyThe key.

Note

If reading fails, get() writes the error to the browser console and resolves with undefined instead of rejecting.

Returns: Promise<T> · Availability: Client

get$<T = any>(key: IDBValidKey): import("rxjs").Observable<T>;

Returns the value stored under a key as an RxJS Observable, which emits the value (or undefined) once and then completes. Unlike get(), it reports read errors through the observable.

ParameterTypeDescription
keyIDBValidKeyThe key.

Returns: Observable<T> · Availability: Client

delete(key: IDBValidKey): Promise<void>;

Deletes the value stored under a key. Does nothing if there is none.

ParameterTypeDescription
keyIDBValidKeyThe key.

Returns: Promise<void> · Availability: Client

openDb(): Promise<IDBPDatabase<unknown>>;

Returns the opened lowgile database as an idb library database object (see the idb documentation), opening it first if needed. The other functions call it themselves, so you need it only for operations they don’t cover, such as listing all keys.

Returns: Promise<IDBPDatabase<unknown>> · Availability: Client