#CouchDB Changes
A JQuery plugin for binding event handlers to the CouchDB _changes feed.
- Bind an event handler to a database _changes longpoll feed.
- Bind an event handler for monitoring of a specific document changes.
- Add ability to select the type of feed
- $.couchdb.changes.database(database, callback):
$.couchdb.changes.database("test", function(changes){
$('ul').append("" + changes.last_seq + " ");
});
- $.couchdb.changes.document(database, document, callback):
$.couchdb.changes.document("test", "test-doc", function(doc){
$('ul').append("" + doc._rev + " ");
});
Stopped working on the pluggin because of the jquery.couch.js include changes feature as well.
Note that this is not included in the plugin shipped with CouchDB 0.11.0!
Here is a code snippet that shows how to use this:
// database changes
$.couch.db('test').changes().onChange(function(resp){
console.log(resp);
});
// include the documents
$.couch.db('test').changes(null, { "include_docs" : "true" }).onChange(function(resp){
console.log(resp);
});