changeset 10:2a87d7a3863f

Clean up code Remove unused method Remove unused parameters Add comments
author Guido Berhoerster <guido+tab-mover@berhoerster.name>
date Mon, 20 Feb 2017 17:00:03 +0100
parents 7b9766eb014f
children 5d7914307782
files background.js
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/background.js	Sun Feb 19 22:03:59 2017 +0100
+++ b/background.js	Mon Feb 20 17:00:03 2017 +0100
@@ -27,7 +27,7 @@
         this._observers = new Map();
     }
 
-    addObserver(eventName, observer, thisArg) {
+    addObserver(eventName, observer) {
         if (!this._observers.has(eventName)) {
             this._observers.set(eventName, new Set());
         }
@@ -60,10 +60,6 @@
         this.focusedWindowId = browser.windows.WINDOW_ID_NONE;
     }
 
-    hasWindow(id) {
-        return this.windows.has(id);
-    }
-
     getWindow(id) {
         return this.windows.get(id);
     }
@@ -100,11 +96,10 @@
     }
 
     focusWindow(id) {
-        let oldId = this.focusedWindowId;
         this.focusedWindowId = this.windows.has(id) ? id :
             browser.windows.WINDOW_ID_NONE;
 
-        this.notifyObservers('window-focus-changed', oldId, id);
+        this.notifyObservers('window-focus-changed', id);
     }
 
     closeWindow(id) {
@@ -179,6 +174,7 @@
     onWindowOpened(eventName, windowId) {
         let focusedWindowId = this.model.getfocusedWindowId();
         if (focusedWindowId === browser.windows.WINDOW_ID_NONE) {
+            // no window is focused so there is no need to update the menu
             return;
         }
 
@@ -208,6 +204,7 @@
     onWindowTitleUpdated(eventName, windowId, title) {
         if (this.model.getfocusedWindowId() ===
             browser.windows.WINDOW_ID_NONE) {
+            // no window is focused so there is no need to update the menu
             return;
         }
 
@@ -216,7 +213,7 @@
         });
     }
 
-    onWindowFocusChanged(eventName, oldWindowId, newWindowId) {
+    onWindowFocusChanged(eventName, newWindowId) {
         let promises = [
             // disable submenus
             browser.contextMenus.update('move-menu', {