B2G/gaia/apps/costcontrol/js/views/balance.js
// Update the balance in balance view
Update the balance in balance view
Update the balance in balance view
function updateBalance(balance, limit) {
    if (!balance) {
      debug('Balance not available');
      balanceView.update();
      return;
    }
    var isUpdating = view.classList.contains('updating');
    balanceView.update(balance, isUpdating);
    if (balance.balance === 0) {
      view.classList.add('no-credit');
    } else {
      view.classList.remove('no-credit');
      if (limit && balance.balance < limit) {
        view.classList.add('low-credit');
      } else {
        view.classList.remove('low-credit');
      }
    }
  }
function updateBalance ( balance , limit ) { if ( ! balance ) { debug ( 'Balance not available' ) ; balanceView . update ( ) ; return ; } var isUpdating = view . classList . contains ( 'updating' ) ; balanceView . update ( balance , isUpdating ) ; if ( balance . balance === 0 ) { view . classList . add ( 'no-credit' ) ; } else { view . classList . remove ( 'no-credit' ) ; if ( limit && balance . balance < limit ) { view . classList . add ( 'low-credit' ) ; } else { view . classList . remove ( 'low-credit' ) ; } } }
Update the balance in balance view
Update the balance in balance view
// Limits: reaching zero / low limit