Skip to content

Commit

Permalink
[SENG-2757] remove custom function from adapter (prebid#11)
Browse files Browse the repository at this point in the history
* remove loadExternalScript function

* add adroll to the adloader whitelist
  • Loading branch information
juanbono authored and abijr committed Jan 22, 2020
1 parent e2fb8fd commit 5162fb0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 27 deletions.
27 changes: 1 addition & 26 deletions modules/adrollBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as utils from '../src/utils';
import { registerBidder } from '../src/adapters/bidderFactory';
import { BANNER } from '../src/mediaTypes';
import { loadExternalScript } from '../src/adloader';
import JSEncrypt from 'jsencrypt/bin/jsencrypt';
import sha256 from 'crypto-js/sha256';

Expand Down Expand Up @@ -285,30 +286,4 @@ function isFastBidTooOld(fastBidAge) {
return false
}

/**
* This is here to bypass the whitelist.
* Once we're ready to merge the adapter to mainstream prebid, we should switch
* from this function to adloader.loadExternalScript
*/
const _requestCache = {};
function loadExternalScript(url, moduleCode) {
if (!moduleCode || !url) {
utils.logError('cannot load external script without url and moduleCode');
return;
}

// only load each asset once
if (_requestCache[url]) {
return;
}

const script = document.createElement('script');
script.type = 'text/javascript';
script.async = true;
script.src = url;

utils.insertElement(script);
_requestCache[url] = true;
};

registerBidder(spec);
3 changes: 2 additions & 1 deletion src/adloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ const _approvedLoadExternalJSList = [
'criteo',
'outstream',
'adagio',
'browsi'
'browsi',
'adroll'
]

/**
Expand Down

0 comments on commit 5162fb0

Please sign in to comment.