From 98bc2326eeeb5d915706dee9aadc2ac3e9af1789 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 6 May 2018 11:45:07 +0900 Subject: Refactor background directories --- src/background/shared/completions/tabs.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/background/shared/completions/tabs.js (limited to 'src/background/shared/completions/tabs.js') 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 }; -- cgit v1.2.3