function hookSync(rs) {
  if (rs._dropboxOrigSync) { return; } // already hooked
  rs._dropboxOrigSync = rs.sync.sync.bind(rs.sync);
  rs.sync.sync = function () {
    return this.dropbox.fetchDelta.apply(this.dropbox, arguments).
      then(rs._dropboxOrigSync, function (err) {
        rs._emit('error', new Sync.SyncError(err));
        rs._emit('sync-done');
      });
  }.bind(rs);
}
function hookSync(rs) {
  if (rs._dropboxOrigSync) { return; } 
  rs._dropboxOrigSync = rs.sync.sync.bind(rs.sync);
  rs.sync.sync = function () {
    return this.dropbox.fetchDelta.apply(this.dropbox, arguments).
      then(rs._dropboxOrigSync, function (err) {
        rs._emit('error', new Sync.SyncError(err));
        rs._emit('sync-done');
      });
  }.bind(rs);
}
function hookSync ( rs ) { if ( rs . _dropboxOrigSync ) { return ; } // already hooked rs . _dropboxOrigSync = rs . sync . sync . bind ( rs . sync ) ; rs . sync . sync = function ( ) { return this . dropbox . fetchDelta . apply ( this . dropbox , arguments ) . then ( rs . _dropboxOrigSync , function ( err ) { rs . _emit ( 'error' , new Sync . SyncError ( err ) ) ; rs . _emit ( 'sync-done' ) ; } ) ; } . bind ( rs ) ; }
Hooking the sync

TODO: document
Hooking the sync