Skip to content

Commit

Permalink
fix: Fix undefined function if apiNotReady (#6)
Browse files Browse the repository at this point in the history
Fix undefined function if apiNotReady. Cribbed from
ticketmaster@5ef19b1.
  • Loading branch information
andrewb authored and andrew-sotiriou committed Dec 18, 2023
1 parent c97c6cd commit 0e35bca
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/Bling.js
Original file line number Diff line number Diff line change
Expand Up @@ -553,13 +553,15 @@ class Bling extends Component {

defineSizeMapping(adSlot, sizeMapping) {
if (sizeMapping) {
Bling._adManager.addMQListener(this, this.props);
const sizeMappingArray = sizeMapping
.reduce((mapping, size) => {
return mapping.addSize(size.viewport, size.slot);
}, Bling._adManager.googletag.sizeMapping())
.build();
adSlot.defineSizeMapping(sizeMappingArray);
Bling._adManager.googletag.cmd.push(() => {
Bling._adManager.addMQListener(this, this.props);
const sizeMappingArray = sizeMapping
.reduce((mapping, size) => {
return mapping.addSize(size.viewport, size.slot);
}, Bling._adManager.googletag.sizeMapping())
.build();
adSlot.defineSizeMapping(sizeMappingArray);
});
}
}

Expand Down

0 comments on commit 0e35bca

Please sign in to comment.