do simple completion
This commit is contained in:
parent
1383b8c12d
commit
73a4fe0bb1
4 changed files with 47 additions and 11 deletions
|
@ -49,6 +49,15 @@ const selectByKeyword = (current, keyword) => {
|
|||
});
|
||||
}
|
||||
|
||||
const getCompletions = (keyword) => {
|
||||
return browser.tabs.query({ currentWindow: true }).then((tabs) => {
|
||||
let matched = tabs.filter((t) => {
|
||||
return t.url.includes(keyword) || t.title.includes(keyword)
|
||||
})
|
||||
return matched;
|
||||
});
|
||||
};
|
||||
|
||||
const selectPrevTab = (current, count) => {
|
||||
return browser.tabs.query({ currentWindow: true }, (tabs) => {
|
||||
if (tabs.length < 2) {
|
||||
|
@ -78,4 +87,4 @@ const reload = (current, cache) => {
|
|||
);
|
||||
};
|
||||
|
||||
export { closeTab, reopenTab, selectAt, selectByKeyword, selectNextTab, selectPrevTab, reload };
|
||||
export { closeTab, reopenTab, selectAt, selectByKeyword, getCompletions, selectPrevTab, selectNextTab, reload };
|
||||
|
|
Reference in a new issue