src/dropbox.js
function hookSyncCycle(rs) {
  if (rs._dropboxOrigSyncCycle) { return; } // already hooked
  rs._dropboxOrigSyncCycle = rs.syncCycle;
  rs.syncCycle = () => {
    if (rs.sync) {
      hookSync(rs);
      rs._dropboxOrigSyncCycle(arguments);
      unHookSyncCycle(rs);
    } else {
      throw new Error('expected sync to be initialized by now');
    }
  };
}
function hookSyncCycle(rs) {
  if (rs._dropboxOrigSyncCycle) { return; } // already hooked
  rs._dropboxOrigSyncCycle = rs.syncCycle;
  rs.syncCycle = () => {
    if (rs.sync) {
      hookSync(rs);
      rs._dropboxOrigSyncCycle(arguments);
      unHookSyncCycle(rs);
    } else {
      throw new Error('expected sync to be initialized by now');
    }
  };
}
function hookSyncCycle ( rs ) { if ( rs . _dropboxOrigSyncCycle ) { return ; } // already hooked rs . _dropboxOrigSyncCycle = rs . syncCycle ; rs . syncCycle = ( ) => { if ( rs . sync ) { hookSync ( rs ) ; rs . _dropboxOrigSyncCycle ( arguments ) ; unHookSyncCycle ( rs ) ; } else { throw new Error ( 'expected sync to be initialized by now' ) ; } } ; }
Hook RemoteStorage.syncCycle as it's the first function called
after RemoteStorage.sync is initialized, so we can then hook
the sync function
@param {object} rs RemoteStorage instance
Hook RemoteStorage . syncCycle as it s the first function called after RemoteStorage . sync is initialized so we can then hook the sync function