Permalink
Browse files

Tweaked scoping of icon nav events

  • Loading branch information...
1 parent fd44524 commit 8eb6e3d4cd5f71277bde21f3505b46dcb85108a8 @robhawkes committed Sep 27, 2012
Showing with 14 additions and 14 deletions.
  1. +14 −14 apps/homescreen/js/page.js
View
@@ -551,30 +551,30 @@ Page.prototype = {
* Activate icon navigation
*/
activateIconNavigation: function pg_activateIconNavigation() {
- var self = this;
- self.isIconNavigation = true;
+ this.isIconNavigation = true;
- window.addEventListener("keydown", self.handleNavigationEvent, true);
- window.addEventListener("MozGamepadButtonDown", self.handleNavigationEvent);
- window.addEventListener("MozGamepadButtonUp", self.handleNavigationEvent);
- window.addEventListener("MozGamepadAxisMove", self.handleNavigationEvent);
+ window.addEventListener("keydown", this.handleNavigationEvent);
+ window.addEventListener("MozGamepadButtonDown", this.handleNavigationEvent);
+ window.addEventListener("MozGamepadButtonUp", this.handleNavigationEvent);
+ window.addEventListener("MozGamepadAxisMove", this.handleNavigationEvent);
- var firstIcon = self.getFirstIcon();
+ var firstIcon = this.getFirstIcon();
firstIcon.container.dataset.active = true;
- self.currentIcon = firstIcon;
+ this.currentIcon = firstIcon;
},
/*
* Deactivate icon navigation
*/
deactivateIconNavigation: function pg_deactivateIconNavigation() {
- var self = this;
- self.isIconNavigation = false;
+ this.isIconNavigation = false;
+
+ console.log("Removing icon navigation listeners");
- window.removeEventListener("keydown", self.handleNavigationEvent);
- window.removeEventListener("MozGamepadButtonDown", self.handleNavigationEvent);
- window.removeEventListener("MozGamepadButtonUp", self.handleNavigationEvent);
- window.removeEventListener("MozGamepadAxisMove", self.handleNavigationEvent);
+ window.removeEventListener("keydown", this.handleNavigationEvent);
+ window.removeEventListener("MozGamepadButtonDown", this.handleNavigationEvent);
+ window.removeEventListener("MozGamepadButtonUp", this.handleNavigationEvent);
+ window.removeEventListener("MozGamepadAxisMove", this.handleNavigationEvent);
},
/*

0 comments on commit 8eb6e3d

Please sign in to comment.