react-native-fh-sync

1.0.1 • Public • Published

RNSync

React Native library to synchronize with a fh-sync server

Required setup

To use the sync client you need a sync server setup first see https://github.com/feedhenry/fh-sync

import RNSync from 'react-native-fh-sync';
 
RNSync.init({
  datasetId: <your dataset id>,
  url: <your sync server url>
});
 
RNSync.notify((notification) => {
  var code = notification.code
  if('sync_complete' === code){
    //a sync loop completed successfully, list the update data
    RNSync.doList(this.messagesId,
      (res) => {
        
        ...
 
      },
      function (err) {
        
        ...
 
      });
  } else {
    //choose other notifications the app is interested in and provide callbacks
  }
});
 
const queryParams = {};
const metaData = {};
RNSync.manage(this.messagesId, {}, queryParams, metaData, () => {});
 

Example

You can find a sample app in the example folder

Package Sidebar

Install

npm i react-native-fh-sync

Weekly Downloads

1

Version

1.0.1

License

ISC

Last publish

Collaborators

  • emilioicai