pouchdb-hoodie-unsynced-local-docs
This PouchDB plugin provides simple methods to check if local DB has unsynced changes.
Usage
// Initialisation var db = 'dbname'var api = db api api // pass doc idapi // pass doc with _id propertyapi // array of IDs and objects
Approach
- we know localDb, but not the state of remoteDB when we are offline
- update_seq(for localDb/remoteDb) + get
_local/
ids for both, 1-time replication & continuous replication* - localDb/_changes?since=
- 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.