Skip to content

Commit

Permalink
removed page visibility and timing function since they are no longer …
Browse files Browse the repository at this point in the history
…required
  • Loading branch information
rishabh-z1tech committed Oct 1, 2024
1 parent ebd5147 commit 105abe3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 35 deletions.
34 changes: 0 additions & 34 deletions modules/vdoaiBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,6 @@ import { config } from '../src/config.js';
const BIDDER_CODE = 'vdoai';
const ENDPOINT_URL = 'https://prebid-v2.vdo.ai/auction';

function getDocumentVisibility(window) {
try {
if (typeof window.document.hidden !== 'undefined') {
return window.document.hidden;
} else if (typeof window.document['msHidden'] !== 'undefined') {
return window.document['msHidden'];
} else if (typeof window.document['webkitHidden'] !== 'undefined') {
return window.document['webkitHidden'];
} else {
return null;
}
} catch (e) {
return null;
}
}

function getFrameNesting() {
let topmostFrame = window;
let parent = window.parent;
Expand All @@ -43,22 +27,6 @@ function getFrameNesting() {
return topmostFrame;
}

function getTiming() {
try {
if (window.performance != null && window.performance.timing != null) {
const timing = {};
const perf = window.performance.timing;
timing.pageLoadTime = perf.loadEventEnd - perf.navigationStart;
timing.connectTime = perf.responseEnd - perf.requestStart;
timing.renderTime = perf.domComplete - perf.domLoading;
return timing;
}
} catch (e) {
return null;
}
return null;
}

/**
* Returns information about the page needed by the server in an object to be converted in JSON
* @returns {{location: *, referrer: (*|string), stack: (*|Array.<String>), numIframes: (*|Number), wWidth: (*|Number), wHeight: (*|Number), sWidth, sHeight, date: string, timeOffset: number}}
Expand All @@ -83,9 +51,7 @@ function getPageInfo(bidderRequest) {
xOffset: topmostFrame.pageXOffset,
docHeight: topmostFrame.document.body ? topmostFrame.document.body.scrollHeight : null,
hLength: history.length,
timing: getTiming(),
yOffset: topmostFrame.pageYOffset,
docHidden: getDocumentVisibility(topmostFrame),
version: {
prebid_version: '$prebid.version$',
adapter_version: '1.0.0',
Expand Down
2 changes: 1 addition & 1 deletion test/spec/modules/vdoaiBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ describe('vdoaiBidAdapter', function () {
expect(request[0].url).to.equal(ENDPOINT_URL);
});
it('should contain all keys', function() {
expect(request[0].data.pageInfo).to.include.all.keys('location', 'referrer', 'stack', 'numIframes', 'sHeight', 'sWidth', 'docHeight', 'wHeight', 'wWidth', 'oHeight', 'oWidth', 'aWidth', 'aHeight', 'sLeft', 'sTop', 'hLength', 'docHidden', 'xOffset', 'yOffset', 'timing', 'version');
expect(request[0].data.pageInfo).to.include.all.keys('location', 'referrer', 'stack', 'numIframes', 'sHeight', 'sWidth', 'docHeight', 'wHeight', 'wWidth', 'oHeight', 'oWidth', 'aWidth', 'aHeight', 'sLeft', 'sTop', 'hLength', 'xOffset', 'yOffset', 'version');
})
it('should return empty array if no valid bid was passed', function () {
expect(spec.buildRequests([], bidderRequests)).to.be.empty;
Expand Down

0 comments on commit 105abe3

Please sign in to comment.