AsyncStorageWithKeyScope is an abstraction built on top of AsyncStorage for Vega. It implements the same API with some restrictions: It adds a clearScope() method to be used instead of the clear() method and Vega’s removeValuesForKeysWithPrefix() method.
AsyncStorage is an unencrypted, asynchronous, persistent, key-value storage system that is global to the app. It should be used instead of LocalStorage.
AsyncStorageWithKeyScope allows you to create instances with a scope prefix string you define. The instance will then transparently prepend all keys with that scope prefix followed by an _ when you make calls to the instance’s APIs and remove the prepended prefix and underscore when returning results.
The AsyncStorageWithKeyScope JavaScript code is a facade that provides a clear JavaScript API, real Error objects, and non-multi functions. Each method in the API returns a Promise object.
Importing the AsyncStorageWithKeyScope library:
Reference
Methods
constructor()
getItem()
key and invokes a callback upon completion. Returns a Promise object.
Parameters:
setItem()
key and invokes a callback upon completion. Returns a Promise object.
Parameters:
removeItem()
key and invokes a callback upon completion. Returns a Promise object.
Parameters:
mergeItem() Vega Not Available
key value with an input value, assuming both values are stringified JSON. Returns a Promise object.
NOTE: This is not supported by all native implementations.
Parameters:
clear() Vega Not Available
AsyncStorageWithKeyScope. Use clearScope instead.
If you want to erase all data in the store use AsyncStorage.clear() directly. It is generally not recommended to clear data for scopes you don’t own.
Parameters:
clearScope()
getAllKeys() Vega Not Available
Promise object.
Parameters:
multiGet()
key inputs. Your callback will be invoked with an array of corresponding key-value pairs found:
Promise object.
Parameters:
multiSet()
Promise object.
Parameters:
multiRemove()
keys array. Returns a Promise object.
Parameters:
removeValuesForKeysWithPrefix() Vega Not Available
clearScope() instead.
Parameters:
multiMerge() Vega Not Available
Promise object.
NOTE: This is not supported by all native implementations.
Parameters:

