Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add getEvents method to the public API #5703

Merged
merged 1 commit into from
Sep 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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