Skip to content

Commit

Permalink
Only attach slotRegistered when autoLoad is set to true (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
dorom authored and jaanauati committed Apr 20, 2018
1 parent 65718ef commit 838ee48
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion js/dfpslotsprovider.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default class DFPSlotsProvider extends React.Component {
componentDidMount() {
DFPManager.setAdSenseAttributes(this.props.adSenseAttributes);
DFPManager.setCollapseEmptyDivs(this.props.collapseEmptyDivs);
if (!this.loadAdsIfPossible()) {
if (this.props.autoLoad && !this.loadAdsIfPossible()) {
DFPManager.on('slotRegistered', this.loadAdsIfPossible);
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/dfpslotsprovider.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ var DFPSlotsProvider = function (_React$Component) {
value: function componentDidMount() {
_manager2.default.setAdSenseAttributes(this.props.adSenseAttributes);
_manager2.default.setCollapseEmptyDivs(this.props.collapseEmptyDivs);
if (!this.loadAdsIfPossible()) {
if (this.props.autoLoad && !this.loadAdsIfPossible()) {
_manager2.default.on('slotRegistered', this.loadAdsIfPossible);
}
}
Expand Down

0 comments on commit 838ee48

Please sign in to comment.