From 84dabe78a24bc6b75e94c8ac6b56eca043c1e9f9 Mon Sep 17 00:00:00 2001 From: Hans Hjort Date: Tue, 17 Oct 2017 08:50:57 -0400 Subject: [PATCH 1/2] Adding an addAdUnits event --- src/constants.json | 3 ++- src/prebid.js | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/constants.json b/src/constants.json index a4649e09c31..806b3790c12 100644 --- a/src/constants.json +++ b/src/constants.json @@ -32,7 +32,8 @@ "BID_RESPONSE": "bidResponse", "BID_WON": "bidWon", "SET_TARGETING": "setTargeting", - "REQUEST_BIDS": "requestBids" + "REQUEST_BIDS": "requestBids", + "ADD_AD_UNITS": "addAdUnits" }, "EVENT_ID_PATHS": { "bidWon": "adUnitCode" diff --git a/src/prebid.js b/src/prebid.js index 4d94fb475ce..334f1676fcb 100644 --- a/src/prebid.js +++ b/src/prebid.js @@ -447,6 +447,8 @@ $$PREBID_GLOBAL$$.addAdUnits = function (adUnitArr) { adUnitArr.transactionId = utils.generateUUID(); $$PREBID_GLOBAL$$.adUnits.push(adUnitArr); } + // emit event + events.emit(ADD_AD_UNITS) }; /** From a628aea97ce77b04fba939dd0a383211eee425d0 Mon Sep 17 00:00:00 2001 From: Hans Hjort Date: Tue, 17 Oct 2017 08:59:24 -0400 Subject: [PATCH 2/2] Fixing errors --- src/prebid.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/prebid.js b/src/prebid.js index 334f1676fcb..4aeb5482100 100644 --- a/src/prebid.js +++ b/src/prebid.js @@ -28,6 +28,7 @@ const { syncUsers, triggerUserSyncs } = userSync; var BID_WON = CONSTANTS.EVENTS.BID_WON; var SET_TARGETING = CONSTANTS.EVENTS.SET_TARGETING; +var ADD_AD_UNITS = CONSTANTS.EVENTS.ADD_AD_UNITS; var auctionRunning = false; var bidRequestQueue = []; @@ -448,7 +449,7 @@ $$PREBID_GLOBAL$$.addAdUnits = function (adUnitArr) { $$PREBID_GLOBAL$$.adUnits.push(adUnitArr); } // emit event - events.emit(ADD_AD_UNITS) + events.emit(ADD_AD_UNITS); }; /**