Skip to content

Conversation

@andrenarchy
Copy link

PouchDB 3 introduced a new API for changes() which now returns an event emitter. The wrapped changes function now also makes use of angular's $q and uses the notify callback if more than one change is expected (e.g., with live: true). Furthermore, the promise is called with an object containing both the change (containing the data) and the changes object (which may be useful for cancelling the subscription).

The new version can, e.g., be used as follows:

var db = pouchdb.create('mydb');
db.changes({live: true}).then(null, null, function (res) {
  // access res.change or res.changes
  // e.g., cancel via res.changes.cancel()
});

@adamduren
Copy link

👍 I experienced an issue using changes() with a newer version of pouchdb and angular-pouchdb today.

The library is expecting onChange() to be passed as an option and appears to fail if it's not passed. It appears this method is deprecated and may be removed in pouchdb 3.0

@andrenarchy
Copy link
Author

@wspringer: is there any reason for not merging the PR?

@NickColley
Copy link

@andrenarchy

@wspringer isn't actively maintaining the project currently so hopefully someone else can help you out here. :)

@jrhicks
Copy link

jrhicks commented Nov 5, 2014

@andrenarchy - You might consider looking at https://github.com/jrhicks/ngPouch - It simplifies working with pouchdb in an Angular app by publishing replication status, managing progressive reconnections, and assisting 3 way binding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants