I need to have currentFunction wait to return its request until baseUrl has executed.
The issue that I have is that adsRequest returns in currentFunction before baseUrl executes.
currentFunction function(){
...
let base = []
function baseUrl(url){
base.push(url)
};
pbjs.requestBids({
timeout: 2000,
//callback that executes when all the bid responses are back or the timeout hits
//the callback receives two parameters
bidsBackHandler : function(bids, timeout) {
console.log(bids)
console.log(timeout)
var videoUrl = pbjs.adServers.dfp.buildVideoUrl({
adUnit: videoAdUnit,
params: {
iu: '/188641797/video/test'
}
});
baseUrl(videoUrl)
}
});
});
adsRequest.adTagUrl = `${base[0]}${targetingQueryParams}`;
return adsRequest;
}