interface StorageArea {
    onChanged: WebExtEvent<
        (changes: { [key: string]: StorageChange }) => void,
    >;
    clear(): Promise<void>;
    get(
        keys?: string | string[] | { [key: string]: any },
    ): Promise<{ [key: string]: any }>;
    getBytesInUse?(keys?: string | string[]): Promise<number>;
    remove(keys: string | string[]): Promise<void>;
    set(items: { [key: string]: any }): Promise<void>;
}
Index
onChanged: WebExtEvent<(changes: { [key: string]: StorageChange }) => void>

Fired when one or more items change.

Object mapping each key that changed to its corresponding storage.StorageChange for that item.

  • Removes all items from storage.

    Returns Promise<void>

  • Gets one or more items from storage.

    Parameters

    • Optionalkeys: string | string[] | { [key: string]: any }

      A single key to get, list of keys to get, or a dictionary specifying default values (see description of the object). An empty list or object will return an empty result object. Pass in null to get the entire contents of storage.

    Returns Promise<{ [key: string]: any }>

  • Gets the amount of space (in bytes) being used by one or more items.

    Parameters

    • Optionalkeys: string | string[]

      A single key or list of keys to get the total usage for. An empty list will return 0. Pass in null to get the total usage of all of storage.

    Returns Promise<number>

    Unsupported on Firefox at this time.

  • Removes one or more items from storage.

    Parameters

    • keys: string | string[]

      A single key or a list of keys for items to remove.

    Returns Promise<void>

  • Sets multiple items.

    Parameters

    • items: { [key: string]: any }

      An object which gives each key/value pair to update storage with. Any other key/value pairs in storage will not be affected.

      Primitive values such as numbers will serialize as expected. Values with a typeof "object" and "function" will typically serialize to {}, with the exception of Array (serializes as expected), Date, and Regex (serialize using their String representation).

    Returns Promise<void>