Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanlawson committed Nov 16, 2014
1 parent 356074f commit 6f49b13
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,19 @@ export default Ember.Route.extend({
afterModel: function (recordArray) {
// This tells PouchDB to listen for live changes and
// notify Ember Data when a change comes in.
new PouchDB('mydb').changes({
var db = new PouchDB('mydb');
db.changes({
since: 'now',
live: true
}).on('change', function () {
}).on('change', function (change) {
// notify Ember of changed/added items
recordArray.update();
// notify Ember of deleted items
if (change.deleted) {
var obj = db.rel.parseDocID(change.id);
var rec = recordArray.store.recordForId(obj.type, obj.id);
recordArray.removeRecord(rec);
}
});
}
});
Expand Down

0 comments on commit 6f49b13

Please sign in to comment.