storage

Type Definitions

data

Key-value data in storage

get(keys) → {Promise.<storage.data>}

Retrieves one or more items from the storage area. This method accepts a key (string) or keys (an array of strings) to identify the item(s) to be retrieved from storage. This is an asynchronous function that returns a Promise that resolves to a results object, containing every object in keys that was found in the storage area.

Parameters:
Name Type Description
keys string | Array.<string>
Returns:
Promise.<storage.data>

set(data) → {Promise.<null>}

Stores one or more items in the storage area, or update existing items. This is an asynchronous function that returns a Promise that will be fulfilled with no arguments if the operation succeeded.

Parameters:
Name Type Description
data storage.data
Returns:
Promise.<null>

storage

Platform-dependent data storage class. For example, when using this library in a browser extension, the storage.local API is compatible. Other platforms may have other ways of dealing with local storage, but it is sufficient to create a small layer for storage to have the specified methods.

Properties:
Name Type Description
get storage.get

Retrieves one or more items from the storage area.

set storage.set

Stores one or more items in the storage area, or update existing items.