blob: 000bd7d531724a13d8141a6258c361c2b3386898 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
const selectPrevTab = (current, count) => {
chrome.tabs.query({ currentWindow: true }, (tabs) => {
if (tabs.length < 2) {
return;
}
let select = (current - count) % tabs.length
let id = tabs[select].id;
chrome.tabs.update(id, { active: true })
});
};
const selectNextTab = (current, count) => {
chrome.tabs.query({ currentWindow: true }, (tabs) => {
if (tabs.length < 2) {
return;
}
let select = (current + count + tabs.length) % tabs.length
let id = tabs[select].id;
chrome.tabs.update(id, { active: true })
});
};
export { selectNextTab, selectPrevTab };
|