Skip to content

Commit

Permalink
reduce loops
Browse files Browse the repository at this point in the history
  • Loading branch information
omerDotan committed Oct 13, 2020
1 parent 6c4ec0d commit 578049e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions modules/rtdModule/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,19 @@ function setEventsListeners() {
export function setBidRequestsData(fn, reqBidsConfigObj) {
_userConsent = getConsentData();

const relevantSubModules = subModules.filter(sm => typeof sm.getBidRequestData === 'function');
const prioritySubModules = relevantSubModules.filter(sm => !!(sm.config && sm.config.waitForIt));
const relevantSubModules = [];
const prioritySubModules = [];
subModules.forEach(sm => {
if (typeof sm.getBidRequestData !== 'function') {
return;
}
relevantSubModules.push(sm);
const config = sm.config;
if (config && config.waitForIt) {
prioritySubModules.push(sm);
}
});

const shouldDelayAuction = prioritySubModules.length && _moduleConfig.auctionDelay && _moduleConfig.auctionDelay > 0;
let callbacksExpected = prioritySubModules.length;
let isDone = false;
Expand Down

0 comments on commit 578049e

Please sign in to comment.