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

Pbjs Core: avoid import all from utils in src/ files #7466

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
33762d1
added support for pubcommon, digitrust, id5id
pm-harshad-mane Sep 12, 2019
0722354
added support for IdentityLink
pm-harshad-mane Sep 13, 2019
f2c32c0
changed the source for id5
pm-harshad-mane Sep 13, 2019
37163d1
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 13, 2019
eaed987
added unit test cases
pm-harshad-mane Sep 13, 2019
602ee7e
changed source param for identityLink
pm-harshad-mane Sep 16, 2019
b6fcd36
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 23, 2019
58381f3
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 26, 2019
c9fb11b
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Oct 10, 2019
8ece7fd
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Oct 16, 2019
28d12a0
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Oct 16, 2019
05a55e1
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Oct 31, 2019
e8b10d5
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Nov 5, 2019
870085f
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Nov 12, 2019
844ce4e
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Nov 12, 2019
704eca3
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Nov 13, 2019
2565cb9
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 4, 2019
1d75bd4
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 4, 2019
6adde1e
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 6, 2019
477c98a
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 9, 2019
cef5422
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 10, 2019
c110a7d
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jan 9, 2020
e8fb062
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 5, 2020
d77cd71
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 17, 2020
817ce3f
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 24, 2020
cda825e
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 26, 2020
f34a3ec
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 27, 2020
f106dc8
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 4, 2020
1f6937e
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 6, 2020
06ffe84
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 6, 2020
5448ceb
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 6, 2020
e9b90fe
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 11, 2020
a7a1d12
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 11, 2020
30b72df
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 26, 2020
76adbc9
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 30, 2020
50e13bc
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 30, 2020
a1c7ca1
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 30, 2020
96fbadc
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Apr 1, 2020
4b026e2
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Apr 9, 2020
38740bc
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Apr 10, 2020
9daf778
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Apr 20, 2020
eff8828
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Apr 21, 2020
ede95de
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Apr 21, 2020
c98f1a1
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Apr 23, 2020
312da6d
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane May 18, 2020
d92972c
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jun 1, 2020
fd4fb2e
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jun 26, 2020
e551136
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jun 30, 2020
cfdca3c
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jul 7, 2020
22505ff
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jul 28, 2020
795a54a
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Aug 10, 2020
433c98b
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 3, 2020
a0521ac
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 24, 2020
635fe74
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 25, 2020
2759212
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Oct 12, 2020
84737d8
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 2, 2020
df5fada
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 2, 2020
9ab7840
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Dec 2, 2020
ed4b566
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jan 8, 2021
f57d220
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jan 20, 2021
6a6d1f4
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 9, 2021
3650c9d
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 10, 2021
85c9d49
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 18, 2021
ca82340
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Feb 23, 2021
12e8f47
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 8, 2021
5d024e7
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Mar 15, 2021
4c87d00
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Apr 22, 2021
93ea6ca
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane May 6, 2021
1eaefc8
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jun 2, 2021
cd4a279
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Jun 7, 2021
4e9ff9f
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Aug 6, 2021
f971232
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Aug 11, 2021
24b2cd0
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 6, 2021
6d3d8a1
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 10, 2021
ae6dbb2
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 21, 2021
a691bc0
Merge remote-tracking branch 'upstream/master'
pm-harshad-mane Sep 23, 2021
cf15276
adloader: not importing * from utils
pm-harshad-mane Sep 23, 2021
a2f32c9
ajax: not importing * from utils
pm-harshad-mane Sep 23, 2021
76efe51
AnalyticsAdapter: not importing * from utils
pm-harshad-mane Sep 23, 2021
c1d8d73
adapterManager: not importing * from utils
pm-harshad-mane Sep 23, 2021
9f9245b
auction: not importing * from utils
pm-harshad-mane Sep 23, 2021
f7bd90c
bidfactory: not importing * from utils
pm-harshad-mane Sep 23, 2021
49f6362
config: not importing * from utils
pm-harshad-mane Sep 23, 2021
194a790
cpmBucketManager: not importing * from utils
pm-harshad-mane Sep 23, 2021
9206406
prebid: not importing * from utils
pm-harshad-mane Sep 23, 2021
bc644ec
Renderer: not importing * from utils
pm-harshad-mane Sep 23, 2021
359894c
storageManager: not importing * from utils
pm-harshad-mane Sep 23, 2021
616f514
targeting: not importing * from utils
pm-harshad-mane Sep 23, 2021
e82d06c
userSync: not importing * from utils
pm-harshad-mane Sep 23, 2021
183f383
videoCache: not importing * from utils
pm-harshad-mane Sep 23, 2021
32cde05
Merge remote-tracking branch 'upstream/master' into avoid_import_all_…
pm-harshad-mane Sep 23, 2021
784439d
Merge remote-tracking branch 'upstream/master' into avoid_import_all_…
pm-harshad-mane Sep 28, 2021
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
12 changes: 6 additions & 6 deletions src/AnalyticsAdapter.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import CONSTANTS from './constants.json';
import { ajax } from './ajax.js';
import { logMessage, _each } from './utils.js';

const events = require('./events.js');
const utils = require('./utils.js');

const {
EVENTS: {
Expand Down Expand Up @@ -123,22 +123,22 @@ export default function AnalyticsAdapter({ url, analyticsType, global, handler }
}
};

utils._each(_handlers, (handler, event) => {
_each(_handlers, (handler, event) => {
events.on(event, handler);
});
} else {
utils.logMessage(`Analytics adapter for "${global}" disabled by sampling`);
logMessage(`Analytics adapter for "${global}" disabled by sampling`);
}

// finally set this function to return log message, prevents multiple adapter listeners
this._oldEnable = this.enableAnalytics;
this.enableAnalytics = function _enable() {
return utils.logMessage(`Analytics adapter for "${global}" already enabled, unnecessary call to \`enableAnalytics\`.`);
return logMessage(`Analytics adapter for "${global}" already enabled, unnecessary call to \`enableAnalytics\`.`);
};
}

function _disable() {
utils._each(_handlers, (handler, event) => {
_each(_handlers, (handler, event) => {
events.off(event, handler);
});
this.enableAnalytics = this._oldEnable ? this._oldEnable : _enable;
Expand All @@ -158,6 +158,6 @@ export default function AnalyticsAdapter({ url, analyticsType, global, handler }
_enableCheck = false;
}

utils.logMessage(`event count sent to ${global}: ${_eventCount}`);
logMessage(`event count sent to ${global}: ${_eventCount}`);
}
}
18 changes: 10 additions & 8 deletions src/Renderer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { loadExternalScript } from './adloader.js';
import * as utils from './utils.js';
import {
logError, logWarn, logMessage, deepAccess
} from './utils.js';
import find from 'core-js-pure/features/array/find.js';
const moduleCode = 'outstream';

Expand All @@ -25,7 +27,7 @@ export function Renderer(options) {
this.cmd = [];
this.push = func => {
if (typeof func !== 'function') {
utils.logError('Commands given to Renderer.push must be wrapped in a function');
logError('Commands given to Renderer.push must be wrapped in a function');
return;
}
this.loaded ? func.call() : this.cmd.push(func);
Expand All @@ -44,7 +46,7 @@ export function Renderer(options) {
if (this._render) {
this._render.apply(this, renderArgs)
} else {
utils.logWarn(`No render function was provided, please use .setRender on the renderer`);
logWarn(`No render function was provided, please use .setRender on the renderer`);
}
}

Expand All @@ -53,7 +55,7 @@ export function Renderer(options) {
this.cmd.unshift(runRender) // should render run first ?
loadExternalScript(url, moduleCode, this.callback);
} else {
utils.logWarn(`External Js not loaded by Renderer since renderer url and callback is already defined on adUnit ${adUnitCode}`);
logWarn(`External Js not loaded by Renderer since renderer url and callback is already defined on adUnit ${adUnitCode}`);
runRender()
}
}.bind(this) // bind the function to this object to avoid 'this' errors
Expand All @@ -80,7 +82,7 @@ Renderer.prototype.handleVideoEvent = function({ id, eventName }) {
this.handlers[eventName]();
}

utils.logMessage(`Prebid Renderer event for id ${id} type ${eventName}`);
logMessage(`Prebid Renderer event for id ${id} type ${eventName}`);
};

/*
Expand All @@ -92,7 +94,7 @@ Renderer.prototype.process = function() {
try {
this.cmd.shift().call();
} catch (error) {
utils.logError('Error processing Renderer command: ', error);
logError('Error processing Renderer command: ', error);
}
}
};
Expand Down Expand Up @@ -126,11 +128,11 @@ function isRendererPreferredFromAdUnit(adUnitCode) {
}

// renderer defined at adUnit level
const adUnitRenderer = utils.deepAccess(adUnit, 'renderer');
const adUnitRenderer = deepAccess(adUnit, 'renderer');
const hasValidAdUnitRenderer = !!(adUnitRenderer && adUnitRenderer.url && adUnitRenderer.render);

// renderer defined at adUnit.mediaTypes level
const mediaTypeRenderer = utils.deepAccess(adUnit, 'mediaTypes.video.renderer');
const mediaTypeRenderer = deepAccess(adUnit, 'mediaTypes.video.renderer');
const hasValidMediaTypeRenderer = !!(mediaTypeRenderer && mediaTypeRenderer.url && mediaTypeRenderer.render)

return !!(
Expand Down
Loading