blob: 20ef2861e0fc8b8677e06200e341fb15e8cad65a (
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) => {
chrome.tabs.query({ currentWindow: true }, (tabs) => {
if (tabs.length < 2) {
return;
}
let select = (current - 1) % tabs.length
let id = tabs[select].id;
chrome.tabs.update(id, { active: true })
});
};
const selectNextTab = (current) => {
chrome.tabs.query({ currentWindow: true }, (tabs) => {
if (tabs.length < 2) {
return;
}
let select = (current + 1 + tabs.length) % tabs.length
let id = tabs[select].id;
chrome.tabs.update(id, { active: true })
});
};
export { selectNextTab, selectPrevTab };
|