From ebf7dbccad143cdc02fcf4d7e8ddba18672fc964 Mon Sep 17 00:00:00 2001 From: Nicolas Faure Date: Thu, 26 Apr 2018 15:57:00 +0200 Subject: [PATCH] Use spec.onTimeout instead of registering an event handler --- modules/criteoBidAdapter.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/modules/criteoBidAdapter.js b/modules/criteoBidAdapter.js index 5f6da034e92..a391af8e9ff 100755 --- a/modules/criteoBidAdapter.js +++ b/modules/criteoBidAdapter.js @@ -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(); + } + }, }; /** @@ -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) {