Fix tab completions

This commit is contained in:
Shin'ya Ueoka 2018-05-12 09:47:21 +09:00
parent 4116d08642
commit a8ac7415f8
4 changed files with 31 additions and 25 deletions

View file

@ -1,7 +1,9 @@
const getCompletions = (keyword) => {
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;
});