PersistentStorage
Extends:
Class for the persistent storage of data on a device using ASyncStorage.
Constructor Summary
Public Constructor | ||
public |
constructor(props: Object) Creates an instance of AuthLoadingView |
Method Summary
Public Methods | ||
public |
checkValid(val: string): Boolean Checks if the parameter passed in is valid. |
|
public |
async getAllStoredKeys(onComplete: Function) Get all the stored keys. |
|
public |
async removeAllData(keepKeys: List, onSuccess: Function, onError: Function) Removes all stored keys in the AsyncStorage. |
|
public |
async removeData(key: string, onError: Function) Removes an item from the persistent storage. |
|
public |
async retrieveData(key: string, onSuccess: Function, onError: Function) Retrieves data from AsyncStorage and calls the success callback with the value. |
|
public |
Stores key, data using AsyncStorage to the device. |
Public Constructors
Public Methods
public checkValid(val: string): Boolean source
Checks if the parameter passed in is valid.
Params:
Name | Type | Attribute | Description |
val | string | A value to check |
public async getAllStoredKeys(onComplete: Function) source
Get all the stored keys.
Params:
Name | Type | Attribute | Description |
onComplete | Function | A callback function to call with an array of keys and an error if it failed. onComplete(error, keys) |
public async removeAllData(keepKeys: List, onSuccess: Function, onError: Function) source
Removes all stored keys in the AsyncStorage.
public async removeData(key: string, onError: Function) source
Removes an item from the persistent storage.
public async retrieveData(key: string, onSuccess: Function, onError: Function) source
Retrieves data from AsyncStorage and calls the success callback with the value.
public async storeData(key: string, value: string/Number, onError: *) source
Stores key, data using AsyncStorage to the device.
Params:
Name | Type | Attribute | Description |
key | string | A key to store data with |
|
value | string/Number | A value to store (can be string or number) |
|
onError | * | An error callback to call if there's an error while storing data |