npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

react-pouchdb-changes

0.1.1 • Public • Published

<PouchDBChanges />

Build Status

Install

npm install react-pouchdb-changes

Using the Component

import PouchDBChanges from 'react-pouchdb-changes';

API

  • dbUrl: String: Required. The URL of the remote CouchDB or the name of the local PouchDB to listen to changes from.
  • dbOpts: Object: Optional. The options that will be passed when connecting to the remote DB. Defaults to an empty object. See the PouchDB Docs for more details.
  • changesOpts: Object: Optional. The options that determine how to consume the changes feed. Defaults to an empty object. Note that if {live: true} is passed here the changes feed is continuously polled until the changes feed is canceled or the component unmounts; otherwise the operation is atomic. See the PouchDB Docs for more details.
  • onChange: Function: Optional. Called when the change event is fired from the changes feed.
  • onComplete: Function: Optional. Called when the complete event is fired from the changes feed.
  • onError: Function: Optional. Called when the error event is fired from the changes feed.
  • onPaused: Function: Optional. Called when the paused event is fired from the changes feed.
  • children: Any: Optional. The children that will be rendered by this component. The PouchDBChanges component does not take responsibility for rendering any UI, so it can be plugged in at the root of your application or anywhere it makes sense to have access to the changes feed.

Example

<PouchDBChanges
  dbUrl='http://localhost:5984/mydb'
  changesOpts={{
    since: 'now',
    live: true,
    include_docs: true
  }}
  onChange={change => this.setState({ latestDoc: change.doc })}
  onError={err => this.handleError(err)}
>
  <App>
    ...
  </App>
</PouchDBChanges>

install

npm i react-pouchdb-changes

Downloadsweekly downloads

6

version

0.1.1

license

Apache-2.0

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability