aboutsummaryrefslogtreecommitdiff
path: root/src/background/repositories
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-07-21 10:35:27 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2018-07-21 16:15:07 +0900
commit890d93fe773ea5cde41d19125d4bad626e54059e (patch)
tree675fbad2261cb6f405589fcc1a553b9900210f63 /src/background/repositories
parentbf7c125fb214b52d67527bdd292a4b5bb81b1d32 (diff)
Buffer completion on Clean Architecture
Diffstat (limited to 'src/background/repositories')
-rw-r--r--src/background/repositories/completions.js11
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);
+ });
+ }
+}