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.
Note: Ensure your keys are determinate or you may not be able to get or remove them later. Keys with timestamps or other variable information may be difficult to identify later and could result in wasted storage.Parameters:
removeItem()
key and invokes a callback upon completion. Returns a Promise object.
Parameters:
clearScope()
multiGet()
key inputs. Your callback will be invoked with an array of corresponding key-value pairs found:
Promise object.
Parameters:
multiSet()
Note: Ensure your keys are determinate or you may not be able to get or remove them later. Keys with timestamps or other variable information may be difficult to identify later and could result in wasted storage.
Promise object.
Parameters:
multiRemove()
keys array. Returns a Promise object.
Parameters:

