You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a page with an infinite scroll and I have followed the steps given in the instructions and also explained in some issues like #112, but when I create a callback to afterEachAdLoaded, each time I invoke dfp() to define the new ad, afterEachAdLoaded receives a repeated callback.
I have followed the code and I think the issue is related to the pubadsService.addEventListener('slotRenderEnded') made on line 137. This listener is added with each call to dfp().
I cannot show public code right now, but it can be reproduced with:
varoptions={dfpID: 'xxxxxxxxx',enableSingleRequest: false,afterEachAdLoaded: function(ad){console.log('afterEachAdLoaded',ad);}};$(document).ready(function(){$.dfp(options);});// This event is triggered when a new page is loaded using ajax$(document).on('new-page-loaded',function($page){console.log('New page');$page.find('.adunit').dfp(options);});
The output shown in the console will be something like:
@pribeh I created pul request #136 but it does not passed all tests so it cannot be evaluated for merging. Hopefully this week or next I will have some time to fix it. Feedback is welcomed
Hi,
First of all, thanks for creating this plugin.
I have a page with an infinite scroll and I have followed the steps given in the instructions and also explained in some issues like #112, but when I create a callback to afterEachAdLoaded, each time I invoke dfp() to define the new ad, afterEachAdLoaded receives a repeated callback.
I have followed the code and I think the issue is related to the pubadsService.addEventListener('slotRenderEnded') made on line 137. This listener is added with each call to dfp().
I cannot show public code right now, but it can be reproduced with:
The output shown in the console will be something like:
After some develop I have created a version that distinguishes between "init" and "new ad" calls.
I am going to make a pull request for your consideration. I have made a strong effort to make it backward-compatible with current code.
I have not added the minified version or propose changes in the readme prior to your comments.
The text was updated successfully, but these errors were encountered: