Skip to content
This repository has been archived by the owner on May 20, 2020. It is now read-only.

Commit

Permalink
fix argument mismatch in chrome api call
Browse files Browse the repository at this point in the history
  • Loading branch information
GaurangTandon committed Jun 10, 2019
1 parent ccfccfb commit 2dbd4e9
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,10 +446,9 @@ chrome.contextMenus.onClicked.addListener((info) => {
});

/**
*
* @param {Number} tabId id of tab
*/
function onTabActivatedOrUpdated({ tabId }) {
function onTabActivatedOrUpdated(tabId) {
const IMG_ACTIVE = "../imgs/r16.png",
IMG_INACTIVE = "../imgs/r16grey.png";
let path = "";
Expand All @@ -469,8 +468,15 @@ function onTabActivatedOrUpdated({ tabId }) {
initContextMenu();
}

chrome.tabs.onActivated.addListener(onTabActivatedOrUpdated);
chrome.tabs.onUpdated.addListener(onTabActivatedOrUpdated);
chrome.tabs.onActivated.addListener(({ tabId }) => onTabActivatedOrUpdated(tabId));
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
// querying partially loaded is not possible
// as content script isn't ready till then
// so we get lots of CRLErros
if (tab.status === "complete") {
onTabActivatedOrUpdated(tabId);
}
});

chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
// when user updates snippet data, reloading page is not required
Expand Down

0 comments on commit 2dbd4e9

Please sign in to comment.