Skip to content

Commit

Permalink
Use spec.onTimeout instead of registering an event handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Spark-NF committed Apr 26, 2018
1 parent 6d81ed4 commit ebf7dbc
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions modules/criteoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,16 @@ export const spec = {

return bids;
},

/**
* @param {TimedOutBid} timeoutData
*/
onTimeout: (timeoutData) => {
if (publisherTagAvailable()) {
const adapter = Criteo.PubTag.Adapters.Prebid.GetAdapter(timeoutData.auctionId);
adapter.handleBidTimeout();
}
},
};

/**
Expand Down Expand Up @@ -261,15 +271,6 @@ function registerEventHandlers() {
}
});

events.on(EVENTS.BID_TIMEOUT, (timedOutBidders) => {
timedOutBidders
.filter(bidder => bidder.bidder === 'criteo')
.map(bidder => {
const adapter = Criteo.PubTag.Adapters.Prebid.GetAdapter(bidder.auctionId);
adapter.handleBidTimeout();
});
});

events.on(EVENTS.SET_TARGETING, () => {
const adapters = Criteo.PubTag.Adapters.Prebid.GetAllAdapters();
for (const k in adapters) {
Expand Down

0 comments on commit ebf7dbc

Please sign in to comment.