Interface IndexedDbWidgetStorage

A store whose calls settle later, as IndexedDB's do. The widget reads a namespace from it once (entries) and answers every later read from that copy, so its own reads stay synchronous; writes follow behind. Having an entries method is what marks a store as asynchronous.

interface IndexedDbWidgetStorage {
    journal?: null | StorageLike;
    close(): void;
    entries(prefix: string): Promise<readonly (readonly [string, string])[]>;
    removeItem(key: string): Promise<void>;
    setItem(key: string, value: string): Promise<void>;
    subscribe(
        listener: (key: string, value: null | string) => void,
    ): () => void;
}

Hierarchy (View Summary)

Properties

journal?: null | StorageLike

A synchronous store the writes still pending are copied to when the page goes away, and read back by the next load, because an asynchronous write started as a page closes may never land. Without one, those writes are lost with the page.

Methods

  • Release the connection and stop listening. Later calls reject.

    Returns void

  • Every stored key that starts with prefix, with its value.

    Parameters

    • prefix: string

    Returns Promise<readonly (readonly [string, string])[]>

  • Hear each write that lands: this store's own, and those of any other store over the same database in another tab. Returns the call that stops listening.

    Parameters

    • listener: (key: string, value: null | string) => void

    Returns () => void