Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pouchdb-hoodie-unsynced-local-docs

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pouchdb-hoodie-unsynced-local-docs

Hoodie-like check for locally changed docs API for PouchDB

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

pouchdb-hoodie-unsynced-local-docs

Build Status Coverage Status Dependency Status devDependency Status

NPM

This PouchDB plugin provides simple methods to check if local DB has unsynced changes.

Usage

// Initialisation

var db = new PouchDB('dbname')
var api = db.unsyncedLocalDocs({remote: 'http://example.com/mydb'})

api.unsyncedLocalDocs()
.then(function(changes) {
  // changes is array of docs?
})

api.unsyncedLocalDocs('docid') // pass doc id
api.unsyncedLocalDocs({_id: 'docid'}) // pass doc with _id property
api.unsyncedLocalDocs(['docid', {_id: 'docid'}]) // array of IDs and objects

Approach

  1. we know localDb, but not the state of remoteDB when we are offline
  2. update_seq(for localDb/remoteDb) + get _local/ ids for both, 1-time replication & continuous replication*
  3. localDb/_changes?since=
  4. if it returns anything: there are changes

hint:

  • https://github.com/pouchdb/pouchdb/blob/master/lib/replicate/genReplicationId.js

Installation

With browserify or on node.js/io.js

Attach this plugin to the PouchDB object:

npm install --save pouchdb
npm install --save pouchdb-hoodie-unsynced-local-docs
Install via npm
var PouchDB = require('pouchdb')
PouchDB.plugin(require('pouchdb-hoodie-unsynced-local-docs'))

Contributing

Have a look at the Hoodie project's contribution guidelines. If you want to hang out you can join #hoodie-pouch on our Hoodie Community Slack.

Keywords

FAQs

Package last updated on 10 Jul 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc