use key-queue for input
This commit is contained in:
parent
e7342e9c23
commit
082450928a
7 changed files with 134 additions and 40 deletions
|
@ -1,20 +1,20 @@
|
|||
const selectPrevTab = (current) => {
|
||||
const selectPrevTab = (current, count) => {
|
||||
chrome.tabs.query({ currentWindow: true }, (tabs) => {
|
||||
if (tabs.length < 2) {
|
||||
return;
|
||||
}
|
||||
let select = (current - 1) % tabs.length
|
||||
let select = (current - count) % tabs.length
|
||||
let id = tabs[select].id;
|
||||
chrome.tabs.update(id, { active: true })
|
||||
});
|
||||
};
|
||||
|
||||
const selectNextTab = (current) => {
|
||||
const selectNextTab = (current, count) => {
|
||||
chrome.tabs.query({ currentWindow: true }, (tabs) => {
|
||||
if (tabs.length < 2) {
|
||||
return;
|
||||
}
|
||||
let select = (current + 1 + tabs.length) % tabs.length
|
||||
let select = (current + count + tabs.length) % tabs.length
|
||||
let id = tabs[select].id;
|
||||
chrome.tabs.update(id, { active: true })
|
||||
});
|
||||
|
|
Reference in a new issue