Store

Store

Class used by an extension to store your data in external:localStorage.

Methods

clear() → {external:Promise}

Source:
Clears all the stored data of an extension
Example
extension.store.clear().then((success) => console.log(success)) // will log ‘true’ when values are cleared
Returns:
Type
external:Promise

get(key) → {external:Promise}

Source:
Gets the value of key
Example
extension.store.get('key').then((value) => console.log(value)) // will log value for the given key
Parameters:
Name Type Description
key string Key of the stored data
Returns:
Type
external:Promise

getAll() → {external:Promise}

Source:
Gets an object with all the stored key-value pairs.
Example
extension.store.getAll().then((obj) => obj)
Returns:
Type
external:Promise

remove(key) → {external:Promise}

Source:
Removes the value of a key
Example
extension.store.remove('key').then((success) => console.log(success)) // will log ‘true’ when value is removed
Parameters:
Name Type Description
key string Key of the data to be removed from the store
Returns:
Type
external:Promise

set(key, value) → {external:Promise}

Source:
Sets the value of a key
Example
extension.store.set('key', 'value').then((success) => console.log(success)) // will log ‘true’ when value is set
Parameters:
Name Type Description
key string Key of the stored data.
value * Data to be stored.
Returns:
Type
external:Promise