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

Andrew s/slimmer #51

Merged
merged 2 commits into from
May 7, 2024
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
36 changes: 0 additions & 36 deletions src/createManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ export const APIToCallBeforeServiceEnabled = [
export class AdManager extends EventEmitter {
constructor(config = {}) {
super(config);

if (config.test) {
this.testMode = config;
}
}

_config = {
Expand All @@ -62,8 +58,6 @@ export class AdManager extends EventEmitter {

_syncCorrelator = false;

_testMode = false;

get googletag() {
return this._googletag;
}
Expand All @@ -84,27 +78,6 @@ export class AdManager extends EventEmitter {
return this.googletag && this.googletag.pubadsReady;
}

get testMode() {
return this._testMode;
}

set testMode(config) {
if (process.env.NODE_ENV === "production") {
return;
}
const {test, GPTMock} = config;
this._isLoaded = true;
this._testMode = !!test;

if (test) {
invariant(
test && GPTMock,
"Must provide GPTMock to enable testMode. config{GPTMock}"
);
this._googletag = new GPTMock(config);
}
}

_processPubadsQueue() {
if (this._pubadsProxyQueue) {
Object.keys(this._pubadsProxyQueue).forEach(method => {
Expand Down Expand Up @@ -159,10 +132,6 @@ export class AdManager extends EventEmitter {
instance.foldCheck(event);
}
});

if (this.testMode) {
this._getTimer();
}
});

_getTimer() {
Expand Down Expand Up @@ -488,11 +457,6 @@ export class AdManager extends EventEmitter {
return (
this._loadPromise ||
(this._loadPromise = new Promise((resolve, reject) => {
// test mode can't be enabled in production mode
if (this.testMode) {
resolve(this.googletag);
return;
}
if (!canUseDOM) {
reject(new Error("DOM not available"));
return;
Expand Down