# HG changeset patch # User Guido Berhoerster # Date 1487606403 -3600 # Node ID 2a87d7a3863f440b8d5e69a6635898a1aec74750 # Parent 7b9766eb014f2f16098ef49eeee985f7ec9dc31f Clean up code Remove unused method Remove unused parameters Add comments diff -r 7b9766eb014f -r 2a87d7a3863f background.js --- 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', {