addons/firefox-addons/tab-mover

changeset 10:2a87d7a3863f

Clean up code
Remove unused method
Remove unused parameters
Add comments
author Guido Berhoerster <guido+tab-mover@berhoerster.name>
date Mon Feb 20 17:00:03 2017 +0100 (2017-02-20)
parents 7b9766eb014f
children 5d7914307782
files background.js
line diff
     1.1 --- a/background.js	Sun Feb 19 22:03:59 2017 +0100
     1.2 +++ b/background.js	Mon Feb 20 17:00:03 2017 +0100
     1.3 @@ -27,7 +27,7 @@
     1.4          this._observers = new Map();
     1.5      }
     1.6  
     1.7 -    addObserver(eventName, observer, thisArg) {
     1.8 +    addObserver(eventName, observer) {
     1.9          if (!this._observers.has(eventName)) {
    1.10              this._observers.set(eventName, new Set());
    1.11          }
    1.12 @@ -60,10 +60,6 @@
    1.13          this.focusedWindowId = browser.windows.WINDOW_ID_NONE;
    1.14      }
    1.15  
    1.16 -    hasWindow(id) {
    1.17 -        return this.windows.has(id);
    1.18 -    }
    1.19 -
    1.20      getWindow(id) {
    1.21          return this.windows.get(id);
    1.22      }
    1.23 @@ -100,11 +96,10 @@
    1.24      }
    1.25  
    1.26      focusWindow(id) {
    1.27 -        let oldId = this.focusedWindowId;
    1.28          this.focusedWindowId = this.windows.has(id) ? id :
    1.29              browser.windows.WINDOW_ID_NONE;
    1.30  
    1.31 -        this.notifyObservers('window-focus-changed', oldId, id);
    1.32 +        this.notifyObservers('window-focus-changed', id);
    1.33      }
    1.34  
    1.35      closeWindow(id) {
    1.36 @@ -179,6 +174,7 @@
    1.37      onWindowOpened(eventName, windowId) {
    1.38          let focusedWindowId = this.model.getfocusedWindowId();
    1.39          if (focusedWindowId === browser.windows.WINDOW_ID_NONE) {
    1.40 +            // no window is focused so there is no need to update the menu
    1.41              return;
    1.42          }
    1.43  
    1.44 @@ -208,6 +204,7 @@
    1.45      onWindowTitleUpdated(eventName, windowId, title) {
    1.46          if (this.model.getfocusedWindowId() ===
    1.47              browser.windows.WINDOW_ID_NONE) {
    1.48 +            // no window is focused so there is no need to update the menu
    1.49              return;
    1.50          }
    1.51  
    1.52 @@ -216,7 +213,7 @@
    1.53          });
    1.54      }
    1.55  
    1.56 -    onWindowFocusChanged(eventName, oldWindowId, newWindowId) {
    1.57 +    onWindowFocusChanged(eventName, newWindowId) {
    1.58          let promises = [
    1.59              // disable submenus
    1.60              browser.contextMenus.update('move-menu', {