Skip to content

Commit

Permalink
feat: add getEvents method to the public API (#5703)
Browse files Browse the repository at this point in the history
  • Loading branch information
gpolaert authored Sep 17, 2020
1 parent 172980b commit db225e9
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/prebid.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @module pbjs */

import { getGlobal } from './prebidGlobal.js';
import { flatten, uniques, isGptPubadsDefined, adUnitsFilter, isArrayOfNums } from './utils.js';
import { adUnitsFilter, flatten, isArrayOfNums, isGptPubadsDefined, uniques } from './utils.js';
import { listenMessagesFromCreative } from './secureCreatives.js';
import { userSync } from './userSync.js';
import { config } from './config.js';
Expand All @@ -11,7 +11,7 @@ import { hook } from './hook.js';
import { sessionLoader } from './debugging.js';
import includes from 'core-js-pure/features/array/includes.js';
import { adunitCounter } from './adUnits.js';
import { isRendererRequired, executeRenderer } from './Renderer.js';
import { executeRenderer, isRendererRequired } from './Renderer.js';
import { createBid } from './bidfactory.js';
import { storageCallbacks } from './storageManager.js';

Expand Down Expand Up @@ -540,6 +540,7 @@ export function executeCallbacks(fn, reqBidsConfigObj) {
runAll(storageCallbacks);
runAll(enableAnalyticsCallbacks);
fn.call(this, reqBidsConfigObj);

function runAll(queue) {
var queued;
while ((queued = queue.shift())) {
Expand Down Expand Up @@ -614,6 +615,16 @@ $$PREBID_GLOBAL$$.offEvent = function (event, handler, id) {
events.off(event, handler, id);
};

/**
* Return a copy of all events emitted
*
* @alias module:pbjs.getEvents
*/
$$PREBID_GLOBAL$$.getEvents = function () {
utils.logInfo('Invoking $$PREBID_GLOBAL$$.getEvents');
return events.getEvents();
};

/*
* Wrapper to register bidderAdapter externally (adapterManager.registerBidAdapter())
* @param {Function} bidderAdaptor [description]
Expand Down Expand Up @@ -730,12 +741,12 @@ $$PREBID_GLOBAL$$.aliasBidder = function (bidderCode, alias, options) {
* @property {string} adserverTargeting.hb_adid The ad ID of the creative, as understood by the ad server.
* @property {string} adserverTargeting.hb_pb The price paid to show the creative, as logged in the ad server.
* @property {string} adserverTargeting.hb_bidder The winning bidder whose ad creative will be served by the ad server.
*/
*/

/**
* Get all of the bids that have been rendered. Useful for [troubleshooting your integration](http://prebid.org/dev-docs/prebid-troubleshooting-guide.html).
* @return {Array<AdapterBidResponse>} A list of bids that have been rendered.
*/
*/
$$PREBID_GLOBAL$$.getAllWinningBids = function () {
return auctionManager.getAllWinningBids();
};
Expand Down Expand Up @@ -767,7 +778,7 @@ $$PREBID_GLOBAL$$.getHighestCpmBids = function (adUnitCode) {
* @property {string} adId The id representing the ad we want to mark
*
* @alias module:pbjs.markWinningBidAsUsed
*/
*/
$$PREBID_GLOBAL$$.markWinningBidAsUsed = function (markBidRequest) {
let bids = [];

Expand Down

0 comments on commit db225e9

Please sign in to comment.