Class

Store

Store

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

Methods

# clear() → {external:Promise}

Clears all the stored data of an extension

View Source store.ts, line 123

external:Promise
Example
extension.store.clear().then((success) => console.log(success)) // will log ‘true’ when values are cleared

# get(key) → {external:Promise}

Gets the value of key
Parameters:
Name Type Description
key string Key of the stored data

View Source store.ts, line 92

external:Promise
Example
extension.store.get('key').then((value) => console.log(value)) // will log value for the given key

# getAll() → {external:Promise}

Gets an object with all the stored key-value pairs.

View Source store.ts, line 99

external:Promise
Example
extension.store.getAll().then((obj) => obj)

# remove(key) → {external:Promise}

Removes the value of a key
Parameters:
Name Type Description
key string Key of the data to be removed from the store

View Source store.ts, line 116

external:Promise
Example
extension.store.remove('key').then((success) => console.log(success)) // will log ‘true’ when value is removed

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

Sets the value of a key
Parameters:
Name Type Description
key string Key of the stored data.
value * Data to be stored.

View Source store.ts, line 108

external:Promise
Example
extension.store.set('key', 'value').then((success) => console.log(success)) // will log ‘true’ when value is set