aboutsummaryrefslogtreecommitdiff
path: root/src/background/completion/TabCompletionUseCase.ts
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2020-04-13 20:37:36 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2020-04-13 20:37:36 +0900
commite1dac618a8b8929f601c7ec8aca3842c5ebf9d03 (patch)
tree6a914a8243c8c02e7752a83667a54d3fa832955c /src/background/completion/TabCompletionUseCase.ts
parent685f2b7b69218b06b5bb676069e35f79c5048c9b (diff)
Use plugin:prettier/recommended
Diffstat (limited to 'src/background/completion/TabCompletionUseCase.ts')
-rw-r--r--src/background/completion/TabCompletionUseCase.ts27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/background/completion/TabCompletionUseCase.ts b/src/background/completion/TabCompletionUseCase.ts
index dec86e9..d0d3bb7 100644
--- a/src/background/completion/TabCompletionUseCase.ts
+++ b/src/background/completion/TabCompletionUseCase.ts
@@ -7,10 +7,9 @@ import TabFlag from "../../shared/TabFlag";
@injectable()
export default class TabCompletionUseCase {
constructor(
- @inject('TabRepository') private tabRepository: TabRepository,
- @inject('TabPresenter') private tabPresenter: TabPresenter,
- ) {
- }
+ @inject("TabRepository") private tabRepository: TabRepository,
+ @inject("TabPresenter") private tabPresenter: TabPresenter
+ ) {}
async queryTabs(query: string, excludePinned: boolean): Promise<TabItem[]> {
const lastTabId = await this.tabPresenter.getLastSelectedId();
@@ -18,17 +17,17 @@ export default class TabCompletionUseCase {
const num = parseInt(query, 10);
let tabs: Tab[] = [];
if (!isNaN(num)) {
- const tab = allTabs.find(t => t.index === num - 1);
+ const tab = allTabs.find((t) => t.index === num - 1);
if (tab) {
tabs = [tab];
}
- } else if (query == '%') {
- const tab = allTabs.find(t => t.active);
+ } else if (query == "%") {
+ const tab = allTabs.find((t) => t.active);
if (tab) {
tabs = [tab];
}
- } else if (query == '#') {
- const tab = allTabs.find(t => t.id === lastTabId);
+ } else if (query == "#") {
+ const tab = allTabs.find((t) => t.id === lastTabId);
if (tab) {
tabs = [tab];
}
@@ -36,20 +35,20 @@ export default class TabCompletionUseCase {
tabs = await this.tabRepository.queryTabs(query, excludePinned);
}
- return tabs.map(tab => {
+ return tabs.map((tab) => {
let flag = TabFlag.None;
if (tab.active) {
- flag = TabFlag.CurrentTab
+ flag = TabFlag.CurrentTab;
} else if (tab.id == lastTabId) {
- flag = TabFlag.LastTab
+ flag = TabFlag.LastTab;
}
return {
index: tab.index + 1,
flag: flag,
title: tab.title,
url: tab.url,
- faviconUrl : tab.faviconUrl
- }
+ faviconUrl: tab.faviconUrl,
+ };
});
}
}