src/ads/fetchAds.js
function _getRequiredAdCountForAdUnit(adUnit) {
    var adContainers = page.getAdContainers(adUnit);

    if (!adContainers.length) {
        return 0;
    }

    var numberOfAdsToInsert = 0;
    for (var i = 0; i < adContainers.length; i++) {
        var adContainer = adContainers[i];
        numberOfAdsToInsert += adContainer.getNumberOfAdsToInsert();
    }

    return numberOfAdsToInsert;
}
function _getRequiredAdCountForAdUnit(adUnit) {
    var adContainers = page.getAdContainers(adUnit);

    if (!adContainers.length) {
        return 0;
    }

    var numberOfAdsToInsert = 0;
    for (var i = 0; i < adContainers.length; i++) {
        var adContainer = adContainers[i];
        numberOfAdsToInsert += adContainer.getNumberOfAdsToInsert();
    }

    return numberOfAdsToInsert;
}
function _getRequiredAdCountForAdUnit ( adUnit ) { var adContainers = page . getAdContainers ( adUnit ) ; if ( ! adContainers . length ) { return 0 ; } var numberOfAdsToInsert = 0 ; for ( var i = 0 ; i < adContainers . length ; i ++ ) { var adContainer = adContainers [ i ] ; numberOfAdsToInsert += adContainer . getNumberOfAdsToInsert ( ) ; } return numberOfAdsToInsert ; }
Get the number of ads this unit needs to place all the ads on the page
@param adUnit The ad unit to get the required number of ads for
@returns {number} the number of required ads
@private
Get the number of ads this unit needs to place all the ads on the page