kaios-types
    Preparing search index...

    Interface DataStore

    Func: "Navigator::HasDataStoreSupport"

    ChromeConstructor

    Exposed: Window, Worker

    interface DataStore {
        name: string;
        onchange: ((this: DataStore, ev: Event) => any) | null;
        owner: string;
        readOnly: boolean;
        revisionId: string;
        add(
            obj: any,
            id?: DataStoreKey,
            revisionId?: string,
        ): Promise<DataStoreKey>;
        addEventListener(
            type: string,
            callback: EventListenerOrEventListenerObject | null,
            options?: boolean | AddEventListenerOptions,
        ): void;
        clear(revisionId?: string): Promise<void>;
        dispatchEvent(event: Event): boolean;
        get(...id: DataStoreKey[]): Promise<any>;
        getLength(): Promise<number>;
        put(obj: any, id: DataStoreKey, revisionId?: string): Promise<void>;
        remove(id: DataStoreKey, revisionId?: string): Promise<boolean>;
        removeEventListener(
            type: string,
            callback: EventListenerOrEventListenerObject | null,
            options?: boolean | EventListenerOptions,
        ): void;
        sync(revisionId?: string): DataStoreCursor;
    }

    Hierarchy

    • EventTarget
      • DataStore
    Index

    Properties

    name: string

    The name of the data store.

    Error if the store is not available.

    onchange: ((this: DataStore, ev: Event) => any) | null

    Event handler called when the store changes.

    owner: string

    The owner of the data store (manifest URL).

    Error if the store is not available.

    readOnly: boolean

    Whether the data store is read-only.

    Error if the store is not available.

    revisionId: string

    The current revision ID of the store.

    Error

    Methods

    • Adds a new object to the store.

      Parameters

      • obj: any

        The object to add.

      • Optionalid: DataStoreKey

        Optional ID for the object.

      • OptionalrevisionId: string

        Optional revision ID to ensure consistency.

      Returns Promise<DataStoreKey>

      A Promise that resolves with the ID of the added object.

      Error

    • The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.

      MDN Reference

      Parameters

      • type: string
      • callback: EventListenerOrEventListenerObject | null
      • Optionaloptions: boolean | AddEventListenerOptions

      Returns void

    • Clears all objects from the store.

      Parameters

      • OptionalrevisionId: string

        Optional revision ID to ensure consistency.

      Returns Promise<void>

      A Promise that resolves when the store is cleared.

      Error

    • The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.

      MDN Reference

      Parameters

      • event: Event

      Returns boolean

    • Retrieves one or more objects from the store by their IDs.

      Parameters

      • ...id: DataStoreKey[]

        The ID(s) of the object(s) to retrieve.

      Returns Promise<any>

      A Promise that resolves with the object(s).

      Error

    • Gets the number of objects in the store.

      Returns Promise<number>

      A Promise that resolves with the count.

      Error

    • Updates an existing object in the store.

      Parameters

      • obj: any

        The object to update.

      • id: DataStoreKey

        The ID of the object.

      • OptionalrevisionId: string

        Optional revision ID to ensure consistency.

      Returns Promise<void>

      A Promise that resolves when the update is complete.

      Error

    • Removes an object from the store.

      Parameters

      • id: DataStoreKey

        The ID of the object to remove.

      • OptionalrevisionId: string

        Optional revision ID to ensure consistency.

      Returns Promise<boolean>

      A Promise that resolves with a boolean indicating success.

      Error

    • The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.

      MDN Reference

      Parameters

      • type: string
      • callback: EventListenerOrEventListenerObject | null
      • Optionaloptions: boolean | EventListenerOptions

      Returns void

    • Synchronizes with the store, returning a cursor for iterating over changes.

      Parameters

      • OptionalrevisionId: string

        The revision ID to start syncing from.

      Returns DataStoreCursor

      A DataStoreCursor object.

      Error