hoodie-client-store
Hoodie-like Store & Sync API on top of PouchDB
This plugin provides simple methods store and sync data. It combines pouchdb-hoodie-api and pouchdb-hoodie-sync.
API
store = dbName options// example:// store = new Store('mydbname', { remote: 'http://localhost:5984/mydbname' })// or:// Store.defaults({remoteBaseUrl: 'http://localhost:5984' })// store = new Store('mydb') // options.ajax: options or function that returns options to be passed to all replications // all methods return promisesstorestorestorestore // with id propertystorestorestorestorestorestorestorestorestorestorestorestorestorestorestorestorestorestorestore// removes all data only triggering the 'clear' event// options are passed to new PouchDB instancestore // sync methods, return native promisesstore // pulls changes one-timestore // pushes changes one-timestore // pulls and pushes changes one-timestore // starts continuous replicationstore // stops continuous replication and all pending requestsstore// pull / push / sync can be filtered by id, object, arraystorestorestore storestorestorestore // eventsstorestorestorestorestorestorestorestorestorestore
Installation
Install via npm
npm install --save pouchdb
npm install --save hoodie-client-store
Including the plugin
With browserify or on node.js/io.js
Attach this plugin to the PouchDB
object:
var Store =
In the browser
Include this plugin in your HTML page:
Since pouchdb.js
is bundled into the plugin by default, there's no need to load it separately.
If you want to load your own PouchDB, just add it before loading the plugin, and it'll use your version of pouchdb.js
.
Additionally we will distribute a "without PouchDB" version hoodie-client-store-without-pouchdb.js
which you
should use if you specify your own pouchdb version.
Testing
Test are currently not running on >IE10 and mobile Safari. This is likely an error with the setup and we would be more than happy if you'd want to fix that :)
In Node.js
Run all tests and validates JavaScript Code Style using standard
npm test
To run only the tests
npm run test:node
In the browser
test:browser:local
This will start a local server. All tests and coverage will be run at http://localhost:8080/__zuul
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.