Skip to content

Commit

Permalink
Illustrative function name
Browse files Browse the repository at this point in the history
updateActiveTab has ambiguous meaning, most prominent of which doesn't mean what we are actually trying to do.
  • Loading branch information
s-c-p committed May 11, 2024
1 parent faadfca commit 5dcff0b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions bookmark-it/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ browser.browserAction.onClicked.addListener(toggleBookmark);
/*
* Switches currentTab and currentBookmark to reflect the currently active tab
*/
function updateActiveTab(tabs) {
function updateAddonStateForActiveTab(tabs) {

function isSupportedProtocol(urlString) {
let supportedProtocols = ["https:", "http:", "ftp:", "file:"];
Expand Down Expand Up @@ -68,19 +68,19 @@ function updateActiveTab(tabs) {
}

// listen for bookmarks being created
browser.bookmarks.onCreated.addListener(updateActiveTab);
browser.bookmarks.onCreated.addListener(updateAddonStateForActiveTab);

// listen for bookmarks being removed
browser.bookmarks.onRemoved.addListener(updateActiveTab);
browser.bookmarks.onRemoved.addListener(updateAddonStateForActiveTab);

// listen to tab URL changes
browser.tabs.onUpdated.addListener(updateActiveTab);
browser.tabs.onUpdated.addListener(updateAddonStateForActiveTab);

// listen to tab switching
browser.tabs.onActivated.addListener(updateActiveTab);
browser.tabs.onActivated.addListener(updateAddonStateForActiveTab);

// listen for window switching
browser.windows.onFocusChanged.addListener(updateActiveTab);
browser.windows.onFocusChanged.addListener(updateAddonStateForActiveTab);

// update when the extension loads initially
updateActiveTab();
updateAddonStateForActiveTab();

0 comments on commit 5dcff0b

Please sign in to comment.