B2G/gaia/apps/communications/dialer/js/call_log.js
/**
   * Updates the whole list of groups or part of it with the appropriate
   * contact information.
   *
   * This function will be triggered after receiving a 'oncontactchange' event
   * with 'create', 'remove' or 'update' reasons or during the initial rendering
   * for each chunk of data *only* if we detect that the contacts cache is not
   * valid.
   *
   * param reason
   *        String containing the reason of the 'oncontactchange' event or null
   *        if the function was triggered because of an invalid contacts cache.
   * param contactId
   *        Contact identifier if any. Only 'oncontactchange' events with
   *        'update' or 'remove' reasons will provide a contactId parameter.
   * param phoneNumbers
   *        Array of phoneNumbers associated with a contact. Only
   *        'oncontactchange' events with 'update' or 'add' reasons will
   *        provide this paramater.
   * param target
   *        DOM element to be updated. We default to the whole log if no
   *        'target' param is provided.
   */
Updates the whole list of groups or part of it with the appropriate
contact information.



param reason
String containing the reason of the 'oncontactchange' event or null
if the function was triggered because of an invalid contacts cache.
param contactId
Contact identifier if any.
Updates the whole list of groups or part of it with the appropriate contact information . param reason String containing the reason of the ' oncontactchange ' event or null if the function was triggered because of an invalid contacts cache . param contactId Contact identifier if any .
function cl_updateList(reason, contactId,
                                                    phoneNumbers, target) {
    var container = target || this.callLogContainer;
    var logs = [];
    switch (reason) {
      case 'remove':
        logs = container.querySelectorAll('li[data-contact-id="' + contactId +
                                          '"]');
        break;
      case 'create':
      case 'update':
      default:
        logs = container.querySelectorAll('.log-item');
        break;
    }
    for (var i = 0, l = logs.length; i < l; i++) {
      var log = logs[i];
      var logInfo = log.dataset;
      if (!reason ||
          (phoneNumbers && phoneNumbers.indexOf(logInfo.phoneNumber) > -1)) {
        this._updateContact(log, logInfo.phoneNumber, i == 0);
      } else if (logInfo.contactId && (logInfo.contactId === contactId)) {
        this._removeContact(log, contactId, i == 0);
      }
    }
  }
function cl_updateList ( reason , contactId , phoneNumbers , target ) { var container = target || this . callLogContainer ; var logs = [ ] ; switch ( reason ) { case 'remove' : logs = container . querySelectorAll ( 'li[data-contact-id="' + contactId + '"]' ) ; break ; case 'create' : case 'update' : default : logs = container . querySelectorAll ( '.log-item' ) ; break ; } for ( var i = 0 , l = logs . length ; i < l ; i ++ ) { var log = logs [ i ] ; var logInfo = log . dataset ; if ( ! reason || ( phoneNumbers && phoneNumbers . indexOf ( logInfo . phoneNumber ) > - 1 ) ) { this . _updateContact ( log , logInfo . phoneNumber , i == 0 ) ; } else if ( logInfo . contactId && ( logInfo . contactId === contactId ) ) { this . _removeContact ( log , contactId , i == 0 ) ; } } }
Updates the whole list of groups or part of it with the appropriate
 contact information.
Updates the whole list of groups or part of it with the appropriate contact information .
// Get the list of logs to be updated.