Merge pull request #38 from nlalonde/master

FIX: too much memory used by long topics
This commit is contained in:
Neil Lalonde 2016-05-16 14:27:51 -04:00
commit 1d907c7897
1 changed files with 14 additions and 1 deletions

View File

@ -116,6 +116,15 @@ function defineSlot(divId, placement, settings, isMobile) {
}
}
function destroySlot(divId) {
if (ads[divId] && window.googletag) {
window.googletag.cmd.push(function(){
window.googletag.destroySlots([ads[divId].ad]);
delete ads[divId];
});
}
}
function loadGoogle() {
if (_loaded) {
return Ember.RSVP.resolve();
@ -208,5 +217,9 @@ export default Ember.Component.extend({
}
});
});
}.on('didInsertElement')
}.on('didInsertElement'),
cleanup: function() {
destroySlot(this.get('divId'));
}.on('willDestroyElement')
});