src/ads/insertAds.js
function handleImageLoad(adElement, adLoadedCallback) {
    var adImage = adElement.querySelector("img");
    if (adImage) {
        (function (adToInsert, adImage) {
            adImage.onload = function () {
                adLoadedCallback(adToInsert, true);
            };
        })(adElement, adImage);
    } else {
        adLoadedCallback(adElement, false);
    }
}
function handleImageLoad(adElement, adLoadedCallback) {
    var adImage = adElement.querySelector("img");
    if (adImage) {
        (function (adToInsert, adImage) {
            adImage.onload = function () {
                adLoadedCallback(adToInsert, true);
            };
        })(adElement, adImage);
    } else {
        adLoadedCallback(adElement, false);
    }
}
function handleImageLoad ( adElement , adLoadedCallback ) { var adImage = adElement . querySelector ( "img" ) ; if ( adImage ) { ( function ( adToInsert , adImage ) { adImage . onload = function ( ) { adLoadedCallback ( adToInsert , true ) ; } ; } ) ( adElement , adImage ) ; } else { adLoadedCallback ( adElement , false ) ; } }
Add an event handler to the onload of ad images.
@param adElement - The HTML element of the advertisement
@param adLoadedCallback - Callback to execute when ads are loaded
Add an event handler to the onload of ad images .