Reputation: 2066
In my Chrome extension, I want to listen for changes to one particular tab only. Using the chrome.tabs.onUpdated.addListener
method, my observation is that this runs on ALL tabs. I have implemented a way to capture the id of the tab that I'm interested in and then check that first, like so:
var extTabId = 10; // captured when this tab is created
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
if (tabId !== extTabId) {
return false;
}
// do whatever else I need this specific tab in question to do
});
Is there an easier way do this so that I only add a listener for extTabId
?
Upvotes: 3
Views: 3518