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 Jan 17, 2019
1 parent d7d6173 commit d292947
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 @@ -534,13 +534,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 d292947

Please sign in to comment.