B2G/gaia/apps/communications/dialer/js/call_log.js
// getting the groups from the DB and rendering them in order.
getting the groups from the DB and rendering them in order.
getting the groups from the DB and rendering them in order .
function cl_render() {
    var self = this;
    var chunk = [];
    var prevDate;
    var startDate = new Date().getTime();
    var screenRendered = false;
    var FIRST_CHUNK_SIZE = 6;
    this._groupCounter = 0;
    CallLogDBManager.getGroupList(function logGroupsRetrieved(cursor) {
      if (!cursor.value) {
        if (self._dbupgrading) {
          return;
        }
        if (chunk.length === 0) {
          self.renderEmptyCallLog();
          self.disableEditMode();
        } else {
          self.renderChunk(chunk);
          if (!screenRendered) {
            PerformanceTestingHelper.dispatch('first-chunk-ready');
          }
          self.enableEditMode();
          FixedHeader.refresh();
          self.updateHeadersContinuously();
          PerformanceTestingHelper.dispatch('call-log-ready');
        }
        return;
      }
      self._empty = false;
      var currDate = new Date(cursor.value.date);
      if (!prevDate || ((currDate - prevDate) === 0)) {
        self._groupCounter++;
        chunk.push(cursor.value);
      } else {
        if (self._groupCounter >= FIRST_CHUNK_SIZE && !screenRendered) {
          screenRendered = true;
          PerformanceTestingHelper.dispatch('first-chunk-ready');
        }
        self.renderChunk(chunk);
        chunk = [cursor.value];
      }
      prevDate = currDate;
      cursor.continue();
    }, 'lastEntryDate', true, true);
  }
function cl_render ( ) { var self = this ; var chunk = [ ] ; var prevDate ; var startDate = new Date ( ) . getTime ( ) ; var screenRendered = false ; var FIRST_CHUNK_SIZE = 6 ; this . _groupCounter = 0 ; CallLogDBManager . getGroupList ( function logGroupsRetrieved ( cursor ) { if ( ! cursor . value ) { if ( self . _dbupgrading ) { return ; } if ( chunk . length === 0 ) { self . renderEmptyCallLog ( ) ; self . disableEditMode ( ) ; } else { self . renderChunk ( chunk ) ; if ( ! screenRendered ) { PerformanceTestingHelper . dispatch ( 'first-chunk-ready' ) ; } self . enableEditMode ( ) ; FixedHeader . refresh ( ) ; self . updateHeadersContinuously ( ) ; PerformanceTestingHelper . dispatch ( 'call-log-ready' ) ; } return ; } self . _empty = false ; var currDate = new Date ( cursor . value . date ) ; if ( ! prevDate || ( ( currDate - prevDate ) === 0 ) ) { self . _groupCounter ++ ; chunk . push ( cursor . value ) ; } else { if ( self . _groupCounter >= FIRST_CHUNK_SIZE && ! screenRendered ) { screenRendered = true ; PerformanceTestingHelper . dispatch ( 'first-chunk-ready' ) ; } self . renderChunk ( chunk ) ; chunk = [ cursor . value ] ; } prevDate = currDate ; cursor . continue ( ) ; } , 'lastEntryDate' , true , true ) ; }
getting the groups from the DB and rendering them in order.
getting the groups from the DB and rendering them in order .