This is what I mean. The code that uses the callbacks
go first, the callbacks themselves are all named and
access to closures withstanding, not nested.
// this is all the code that is used,
var _changes = follow(couchOpts);
_changes.on('change', onChange);
_changes.on('error', onError);
_changes.resume();
// from here is just named functions
function onChange(data) {
_changes.pause();
save(data.seqId, saveFn);
}
function saveFn(err, entity) {
if (err) { return console.log(err); }
_changes.resume();
}
function onError(err) {
console.log(err);
}