MCPcopy
hub / github.com/philc/vimium / getTabIndex

Function getTabIndex

background_scripts/main.js:161–168  ·  view source on GitHub ↗
(tab, tabs)

Source from the content-addressed store, hash-verified

159// Find a tab's actual index in a given tab array returned by chrome.tabs.query. In Firefox, there
160// may be hidden tabs, so tab.tabIndex may not be the actual index into the array of visible tabs.
161function getTabIndex(tab, tabs) {
162 // First check if the tab is where we expect it, to avoid searching the array.
163 if (tabs.length > tab.index && tabs[tab.index].index === tab.index) {
164 return tab.index;
165 } else {
166 return tabs.findIndex((t) => t.index === tab.index);
167 }
168}
169
170//
171// Selects the tab with the ID specified in request.id

Callers 5

moveTabFunction · 0.85
moveTabToNewWindowFunction · 0.85
forCountTabsFunction · 0.85
removeTabsRelativeFunction · 0.85
selectTabFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected