Skip to content
This repository has been archived by the owner on Jun 4, 2023. It is now read-only.

Commit

Permalink
receiver: remove load listener when removing a frame
Browse files Browse the repository at this point in the history
Do not hold a reference to a frame which is not displayed anymore.
  • Loading branch information
vincentbernat committed Nov 25, 2016
1 parent 14c3414 commit 39638e8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions app/scripts/receiver/iframe-queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ module.exports = (function(window, undefined) {
this.el = document.createElement('iframe');
document.body.appendChild(this.el);

var vp = new Viewport(dashboard.viewport, this.el),
load = function() {
this.el.removeEventListener('load', load, false);
var vp = new Viewport(dashboard.viewport, this.el);
this.load = function() {
this.el.removeEventListener('load', this.load, false);
if (dashboard.delay) {
console.info('[Dashkiosk] iframe ready ' +
this.el.getAttribute('src') +
Expand All @@ -24,7 +24,7 @@ module.exports = (function(window, undefined) {
this.show();
}
}.bind(this);
this.el.addEventListener('load', load, false);
this.el.addEventListener('load', this.load, false);

this.el.setAttribute('scrolling', 'no');
this.el.setAttribute('frameborder', '0');
Expand All @@ -41,6 +41,7 @@ module.exports = (function(window, undefined) {
};

Iframe.prototype.remove = function() {
this.el.removeEventListener('load', this.load, false);
if (this.el.classList.contains('show')) {
this.el.classList.remove('show');
window.setTimeout(function() {
Expand Down

0 comments on commit 39638e8

Please sign in to comment.