Skip to content

Latest commit

 

History

History
35 lines (29 loc) · 999 Bytes

README.md

File metadata and controls

35 lines (29 loc) · 999 Bytes

React Native AsyncStorage (WIP)

An abstraction on top of react-native's AsyncStorage.
Not tested in the production. Use it on your risk.
PR is awesome :)

####Installation npm install react-native-async-storage

####Methods

####Simple example

ReactNativeAsyncStorage.using('model_name')
  .then((model) => {
    model.get(id);
    model.find();
    model.add({field1: 'value'});
    model.add([{field2: 'value'}, {field3: 'value'}]);
    
    // Save changes when all manipulations are done.
    model.save()
      .then(() => {
        console.log('Model has been saved');
      })
      .catch((err) => console.log('Oops...', err));
  })
  .catch((err) => console.log('Oops...', err));