SyncStorage
Synchronous storage for React Native AsyncStorage.
Get Started
Installation
yarn add sync-storage# or # npm i --save sync-storage
Usage
; SyncStorage; const result = SyncStorage;console; // 'bar'
Methods Available
init()
Init prepares the SyncStorage to work synchronously, by getting all values for all keys previously saved on RN AsyncStorage. See the example:
const data = await SyncStorage;console;
get(key: string)
Returns the value of key.
SyncStorage; // 'bar'
set(key: string, value: Any type)
It saves the value on memory and on the AsyncStorage.
SyncStorage;SyncStorage; // 'bar'
It also returns a Promise for post verification.
SyncStorage ;
remove(key: string)
It removes the value from the memory and from the AsyncStorage.
SyncStorage;
It also returns a Promise for post verification.
SyncStorage ;
getAllKeys()
returns an array from all the keys.
SyncStorage;SyncStorage;console // ['foo', 'boo']