Use queryByKeyword for tab operations

This commit is contained in:
Shin'ya Ueoka 2018-05-30 22:05:12 +09:00
parent e286aab3d7
commit 68fa80e1a3
2 changed files with 27 additions and 33 deletions

View file

@ -1,12 +1,8 @@
import * as tabs from '../tabs';
const getCompletions = (keyword, excludePinned) => {
return browser.tabs.query({ currentWindow: true }).then((tabs) => {
let matched = tabs.filter((t) => {
return t.url.includes(keyword) || t.title && t.title.includes(keyword);
}).filter((t) => {
return !(excludePinned && t.pinned);
});
return matched;
});
return tabs.queryByKeyword(keyword, excludePinned);
};
export { getCompletions };