aboutsummaryrefslogtreecommitdiff
path: root/src/background/shared/completions/tabs.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/background/shared/completions/tabs.js')
-rw-r--r--src/background/shared/completions/tabs.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/background/shared/completions/tabs.js b/src/background/shared/completions/tabs.js
new file mode 100644
index 0000000..5edddca
--- /dev/null
+++ b/src/background/shared/completions/tabs.js
@@ -0,0 +1,10 @@
+const getCompletions = (keyword) => {
+ return browser.tabs.query({ currentWindow: true }).then((tabs) => {
+ let matched = tabs.filter((t) => {
+ return t.url.includes(keyword) || t.title && t.title.includes(keyword);
+ });
+ return matched;
+ });
+};
+
+export { getCompletions };