Latest 0.1.3
Homepage https://github.com/pwcremin/RNSync
License MIT
Platforms ios 7.0, requires ARC
Dependencies React, CDTDatastore
Authors

[![CI Status](http://img.shields.io/travis/Patrick Cremin/RNSync.svg?style=flat)](https://travis-ci.org/Patrick Cremin/RNSync)
Version
License
Platform

Installation

Install with npm

npm install --save rnsync

Edit your Podfile

pod 'rnsync', :path => '../node_modules/rnsync'

Pod install

pod install

Usage

Connect

var rnsync = require('rnsync');

// connect to your cloudant server
var dbUrl = "https://xxxxx";
var dbName = "name_xxxx";

rnsync.init(dbUrl, dbName, function(error)
{
  console.log(error);
}

Create

Both the object and the id are optional. If you leave out the object, it will create a new doc that is empty. If you leave
out the id that will be autogenerated for you.

var object = {x:10};
var id = "whatever";

rnsync.create(object, id, function(error, docs)
{
  console.log(docs[0].id);
}

Retrieve


var id = "whatever";

rnsync.retrieve(id, function(error, docs)
{
  console.log(JSON.stringify(docs[0].body));
}

Update


doc.body.somechange = "hi mom";

rnsync.update(doc.id, doc.rev, doc.body, function(error, docs)
{
  console.log(JSON.stringify(docs[0].body));
}

Delete


rnsync.update(doc.id, function(error)
{
  console.log(error);
}

Replicate

All of the CRUD functions only affect the local database. To push your changes to the remote server you must replicate.

rnsync.replicate(function(error)
{
  console.log(error);
}

Author

Patrick Cremin, [email protected]

License

RNSync is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "RNSync",
    "version": "0.1.3",
    "summary": "A React Native compatible version of Cloudant Sync",
    "description": ""A React Native compatible version of Cloudant Sync"",
    "homepage": "https://github.com/pwcremin/RNSync",
    "license": "MIT",
    "authors": {
        "Patrick Cremin": "[email protected]"
    },
    "source": {
        "git": "https://github.com/pwcremin/RNSync.git",
        "tag": "0.1.3"
    },
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "resource_bundles": {
        "RNSync": [
            "Pod/Assets/*.png"
        ]
    },
    "dependencies": {
        "React": [],
        "CDTDatastore": []
    }
}

Pin It on Pinterest

Share This