AsyncStorage is an unencrypted, asynchronous, persistent, key-value storage system that is global to the app. It should be used instead of LocalStorage.
It is recommended that you use an abstraction on top of AsyncStorage instead of AsyncStorage directly for anything more than light usage since it operates globally. Vega provides AsyncStorageWithKeyScope or you can create your own abstraction.
On Vega, AsyncStorage is backed by a SQLite database. On iOS, AsyncStorage is backed by native code that stores small values in a serialized dictionary and larger values in separate files. On Android, AsyncStorage will use either RocksDB or SQLite based on what is available.
The AsyncStorage 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 AsyncStorage library:
Reference
Methods
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()
AsyncStorage for all clients, libraries, etc. You probably don’t want to call this; use removeItem or multiRemove to clear only your app’s keys. Returns a Promise object.
Parameters:
getAllKeys() Vega Not Available
Promise object.
Parameters:
flushGetRequests() Vega Not Available
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 v2
prefix. Returns a Promise object.
Parameters:
multiMerge() Vega Not Available
Promise object.
NOTE: This is not supported by all native implementations.
Parameters:

