Coder Social home page Coder Social logo

pouchdb-csg's Introduction

Cordova+CSG plugin for PouchDB

This PouchDB plugin aims at improving the performance of synchronization with Couchbase Sync Gateway when used in a cordova app.

It is still in an early stage of development, use it at own risk!

What does this plugin do?

It provides a hook for enabling multipart responses when used inside an embedded browser view (for example PhoneGap / Cordova): CSG's _bulk_get endpoint always answers in multipart/mixed mode. As this is not well supported by the browsers, PouchDB falls back to one request per document, which can be very efficient. If your pouch instance run in an environment where you have access to a method to perform HTTP calls that supports multipart/mixed, this plugin provides a hook for using it for _bulk_get. See below for usage.

In order to improve the synchronization process even more, have a look at the pouchdb-thrifty plugin.

Usage

import PouchDBCSG from 'pouchdb-csg';
import {multipartProvider} from './multipart';

PouchDB.plugin(PouchDBCSG({
  multipartProvider: multipartProvider // this is optional
}));

The multipartProvider is optional; it has to be a function that performs an HTTP call:

function multipartProvider(method, url, headers, body) {
  return do_http_call(method, url, headers, body); // has to return a promise
}

It has to perform a request, parse the multipart/mixed content and return a list of the contained JSON objects.

pouchdb-csg's People

Contributors

hermitdemschoenenleben avatar nolanlawson avatar

Stargazers

gk avatar Mourad ZOUABI avatar Jeff Hilton avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.