diff options
Diffstat (limited to 'src/background/repositories/completions.js')
-rw-r--r-- | src/background/repositories/completions.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/background/repositories/completions.js b/src/background/repositories/completions.js new file mode 100644 index 0000000..30ede05 --- /dev/null +++ b/src/background/repositories/completions.js @@ -0,0 +1,11 @@ +export default class CompletionsRepository { + async queryTabs(keywords, excludePinned) { + let tabs = await browser.tabs.query({ currentWindow: true }); + return tabs.filter((t) => { + return t.url.toLowerCase().includes(keywords.toLowerCase()) || + t.title && t.title.toLowerCase().includes(keywords.toLowerCase()); + }).filter((t) => { + return !(excludePinned && t.pinned); + }); + } +} |