Skip to content

Commit

Permalink
Fixing event handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
MeoMix committed Mar 31, 2015
1 parent c74ee36 commit 60635e9
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/js/foreground/view/foregroundAreaView.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,15 @@
this.player = Streamus.backgroundPage.player;
this.settings = Streamus.backgroundPage.settings;
this.bindEntityEvents(this.player, this.playerEvents);

// TODO: Pretty sure I should not be assigning like this.
window.onunload = this._onWindowUnload.bind(this);
window.onresize = this._onWindowResize.bind(this);
window.onerror = this._onWindowError.bind(this);

// It's important to bind pre-emptively or attempts to call removeEventListener will fail to find the appropriate reference.
this._onWindowUnload = this._onWindowUnload.bind(this);
this._onWindowResize = this._onWindowResize.bind(this);
this._onWindowError = this._onWindowError.bind(this);

window.addEventListener('unload', this._onWindowUnload);
window.addEventListener('resize', this._onWindowResize);
window.addEventListener('error', this._onWindowError);

Streamus.backgroundPage.analyticsManager.sendPageView('/foreground.html');
},
Expand Down

0 comments on commit 60635e9

Please sign in to comment.