aboutsummaryrefslogtreecommitdiff
path: root/src/background/repositories
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2020-03-26 07:17:55 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2020-03-26 22:15:09 +0900
commit6829e24c62c0291336502b3390905b57b81abd21 (patch)
treeb6fa9b1058be1588e313cae3c08bdbbf7f175001 /src/background/repositories
parent70b08f1025d3e00a016843669d61c56789bc0028 (diff)
Use new completion use-case on current use-case (aliased)
Diffstat (limited to 'src/background/repositories')
-rw-r--r--src/background/repositories/CompletionsRepository.ts24
1 files changed, 0 insertions, 24 deletions
diff --git a/src/background/repositories/CompletionsRepository.ts b/src/background/repositories/CompletionsRepository.ts
index dfecff0..7d0434c 100644
--- a/src/background/repositories/CompletionsRepository.ts
+++ b/src/background/repositories/CompletionsRepository.ts
@@ -1,33 +1,9 @@
import { injectable } from 'tsyringe';
type Tab = browser.tabs.Tab;
-type BookmarkTreeNode = browser.bookmarks.BookmarkTreeNode;
@injectable()
export default class CompletionsRepository {
- async queryBookmarks(keywords: string): Promise<BookmarkTreeNode[]> {
- const items = await browser.bookmarks.search({ query: keywords });
- return items.filter((item) => {
- if (!item.url) {
- return false;
- }
- let url = undefined;
- try {
- url = new URL(item.url);
- } catch (e) {
- return false;
- }
- return item.type === 'bookmark' && url.protocol !== 'place:';
- });
- }
-
- queryHistories(keywords: string): Promise<browser.history.HistoryItem[]> {
- return browser.history.search({
- text: keywords,
- startTime: 0,
- });
- }
-
async queryTabs(keywords: string, excludePinned: boolean): Promise<Tab[]> {
const tabs = await browser.tabs.query({ currentWindow: true });
return tabs.filter((t) => {