3 ms·
The example code is somewhat weird: var db = new PouchDB('dbname'); db.put({ _id: 'dave@gmail.com', name: 'David', age: 66 }); db.cha
by vog 13y ago
The example code is somewhat weird:
var db = new PouchDB('dbname');
db.put({
_id: 'dave@gmail.com',
name: 'David',
age: 66
});
db.changes({
onChange: function() {
console.log('Ch-Ch-Changes');
}
});
db.replicate.to('http://example.com/mydb');
Shouldn't you set up the event listener before "db.put()"?
- daleharvey 13y agoI mostly just wanted to highlight the key features with 'real' code in the order you would come across them, you are right though might be worth switching that, thanks
- wodow 13y agoYou could define two functions to wrap the calls - do_a_put(), do_a_sync() - in that order and then call them in the reversed order in the example?