Add status handling to couch sync service

This adds a status to the couch sync service. Status can be "sync", "online", "offline". The status can be observed using sync.onStatusChange().

The idea is to reduce the number of pouchdb event handler registrations throughout the application. This can also be used by controllers to know when they can fetch data using the views. Maybe a sync.ready() method should be used (which is called when status moves to "online").
You can also use the error function defined above to reject the promise (catch(error))