Skip to content
This repository has been archived by the owner on Nov 26, 2021. It is now read-only.

Commit

Permalink
Stop error from google ads sdk spamming sentry (#121)
Browse files Browse the repository at this point in the history
* Stop error from google ads sdk spamming sentry

* Static method

* Fixed tests

* OOps
  • Loading branch information
alexflorisca authored Jun 8, 2018
1 parent 552b940 commit 166e5a2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/js/ads.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class VideoAds {
this.adsCompleted = false;
}

loadAdsLibrary() {
static loadAdsLibrary() {
return new Promise((resolve, reject) => {
let googleSdkScript = document.querySelector('[src="//imasdk.googleapis.com/js/sdkloader/ima3.js"]');

Expand All @@ -43,7 +43,6 @@ class VideoAds {
});

googleSdkScript.addEventListener('error', (e) => {
this.reportError(e);
reject(e);
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/js/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class Video {
}

init() {
return (this.opts.advertising ? this.videoAds.loadAdsLibrary() : Promise.resolve())
return (this.opts.advertising ? VideoAds.loadAdsLibrary() : Promise.resolve())
.catch(() => {
// If ad doesn't load for some reason, load video as normal
this.opts.advertising = false;
Expand Down
2 changes: 1 addition & 1 deletion test/ads.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Ads', () => {
});

it('should add the video advertising script if the configuration parameter is passed', () => {
return ads.loadAdsLibrary()
return Ads.loadAdsLibrary()
.then(() => {
proclaim.ok(document.querySelector('[src="//imasdk.googleapis.com/js/sdkloader/ima3.js"]'));
});
Expand Down

0 comments on commit 166e5a2

Please sign in to comment.