aboutsummaryrefslogtreecommitdiff
path: root/src/background/usecases
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2019-02-24 20:54:35 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2019-02-24 21:58:12 +0900
commita26d8a8a1bed48a77e062914c120a23ace7bb8cf (patch)
tree29ce84b9b03e87e818197b63d77e20e5a897cf0b /src/background/usecases
parent21788740c1d4ee28ce05d6bd09d37901d1d88b68 (diff)
Capitalize background scripts
Diffstat (limited to 'src/background/usecases')
-rw-r--r--src/background/usecases/AddonEnabledUseCase.js (renamed from src/background/usecases/addon-enabled.js)8
-rw-r--r--src/background/usecases/CommandUseCase.js (renamed from src/background/usecases/command.js)16
-rw-r--r--src/background/usecases/CompletionsUseCase.js (renamed from src/background/usecases/completions.js)26
-rw-r--r--src/background/usecases/FindUseCase.js (renamed from src/background/usecases/find.js)4
-rw-r--r--src/background/usecases/LinkUseCase.js (renamed from src/background/usecases/link.js)6
-rw-r--r--src/background/usecases/MarkUseCase.js (renamed from src/background/usecases/mark.js)16
-rw-r--r--src/background/usecases/OperationUseCase.js (renamed from src/background/usecases/operation.js)24
-rw-r--r--src/background/usecases/SettingUseCase.js (renamed from src/background/usecases/setting.js)9
-rw-r--r--src/background/usecases/VersionUseCase.js (renamed from src/background/usecases/version.js)8
9 files changed, 59 insertions, 58 deletions
diff --git a/src/background/usecases/addon-enabled.js b/src/background/usecases/AddonEnabledUseCase.js
index d83192f..bb2c347 100644
--- a/src/background/usecases/addon-enabled.js
+++ b/src/background/usecases/AddonEnabledUseCase.js
@@ -1,8 +1,8 @@
-import IndicatorPresenter from '../presenters/indicator';
-import TabPresenter from '../presenters/tab';
-import ContentMessageClient from '../infrastructures/content-message-client';
+import IndicatorPresenter from '../presenters/IndicatorPresenter';
+import TabPresenter from '../presenters/TabPresenter';
+import ContentMessageClient from '../infrastructures/ContentMessageClient';
-export default class AddonEnabledInteractor {
+export default class AddonEnabledUseCase {
constructor() {
this.indicatorPresentor = new IndicatorPresenter();
diff --git a/src/background/usecases/command.js b/src/background/usecases/CommandUseCase.js
index 0d21041..9ec46fe 100644
--- a/src/background/usecases/command.js
+++ b/src/background/usecases/CommandUseCase.js
@@ -1,11 +1,11 @@
import * as parsers from './parsers';
import * as urls from '../../shared/urls';
-import TabPresenter from '../presenters/tab';
-import WindowPresenter from '../presenters/window';
-import SettingRepository from '../repositories/setting';
-import BookmarkRepository from '../repositories/bookmark';
-import ConsolePresenter from '../presenters/console';
-import ContentMessageClient from '../infrastructures/content-message-client';
+import TabPresenter from '../presenters/TabPresenter';
+import WindowPresenter from '../presenters/WindowPresenter';
+import SettingRepository from '../repositories/SettingRepository';
+import BookmarkRepository from '../repositories/BookmarkRepository';
+import ConsoleClient from '../infrastructures/ConsoleClient';
+import ContentMessageClient from '../infrastructures/ContentMessageClient';
import * as properties from 'shared/settings/properties';
export default class CommandIndicator {
@@ -14,7 +14,7 @@ export default class CommandIndicator {
this.windowPresenter = new WindowPresenter();
this.settingRepository = new SettingRepository();
this.bookmarkRepository = new BookmarkRepository();
- this.consolePresenter = new ConsolePresenter();
+ this.consoleClient = new ConsoleClient();
this.contentMessageClient = new ContentMessageClient();
}
@@ -105,7 +105,7 @@ export default class CommandIndicator {
let tab = await this.tabPresenter.getCurrent();
let item = await this.bookmarkRepository.create(title, tab.url);
let message = 'Saved current page: ' + item.url;
- return this.consolePresenter.showInfo(tab.id, message);
+ return this.consoleClient.showInfo(tab.id, message);
}
async set(keywords) {
diff --git a/src/background/usecases/completions.js b/src/background/usecases/CompletionsUseCase.js
index 21dc668..7dc30ac 100644
--- a/src/background/usecases/completions.js
+++ b/src/background/usecases/CompletionsUseCase.js
@@ -1,19 +1,19 @@
-import CompletionItem from '../domains/completion-item';
-import CompletionGroup from '../domains/completion-group';
-import Completions from '../domains/completions';
-import CommandDocs from '../domains/command-docs';
-import CompletionRepository from '../repositories/completions';
+import CompletionItem from '../domains/CompletionItem';
+import CompletionGroup from '../domains/CompletionGroup';
+import Completions from '../domains/Completions';
+import CommandDocs from '../domains/CommandDocs';
+import CompletionsRepository from '../repositories/CompletionsRepository';
import * as filters from './filters';
-import SettingRepository from '../repositories/setting';
-import TabPresenter from '../presenters/tab';
+import SettingRepository from '../repositories/SettingRepository';
+import TabPresenter from '../presenters/TabPresenter';
import * as properties from '../../shared/settings/properties';
const COMPLETION_ITEM_LIMIT = 10;
-export default class CompletionsInteractor {
+export default class CompletionsUseCase {
constructor() {
this.tabPresenter = new TabPresenter();
- this.completionRepository = new CompletionRepository();
+ this.completionsRepository = new CompletionsRepository();
this.settingRepository = new SettingRepository();
}
@@ -86,7 +86,7 @@ export default class CompletionsInteractor {
tabs = [tab];
}
} else {
- tabs = await this.completionRepository.queryTabs(keywords, false);
+ tabs = await this.completionsRepository.queryTabs(keywords, false);
}
const flag = (tab) => {
if (tab.active) {
@@ -153,7 +153,7 @@ export default class CompletionsInteractor {
}
async queryTabs(name, excludePinned, args) {
- let tabs = await this.completionRepository.queryTabs(args, excludePinned);
+ let tabs = await this.completionsRepository.queryTabs(args, excludePinned);
let items = tabs.map(tab => new CompletionItem({
caption: tab.title,
content: name + ' ' + tab.title,
@@ -177,7 +177,7 @@ export default class CompletionsInteractor {
}
async queryHistoryItems(name, keywords) {
- let histories = await this.completionRepository.queryHistories(keywords);
+ let histories = await this.completionsRepository.queryHistories(keywords);
histories = [histories]
.map(filters.filterBlankTitle)
.map(filters.filterHttp)
@@ -194,7 +194,7 @@ export default class CompletionsInteractor {
}
async queryBookmarkItems(name, keywords) {
- let bookmarks = await this.completionRepository.queryBookmarks(keywords);
+ let bookmarks = await this.completionsRepository.queryBookmarks(keywords);
return bookmarks.slice(0, COMPLETION_ITEM_LIMIT)
.map(page => new CompletionItem({
caption: page.title,
diff --git a/src/background/usecases/find.js b/src/background/usecases/FindUseCase.js
index eae480d..d6b0323 100644
--- a/src/background/usecases/find.js
+++ b/src/background/usecases/FindUseCase.js
@@ -1,6 +1,6 @@
-import FindRepository from '../repositories/find';
+import FindRepository from '../repositories/FindRepository';
-export default class FindInteractor {
+export default class FindUseCase {
constructor() {
this.findRepository = new FindRepository();
}
diff --git a/src/background/usecases/link.js b/src/background/usecases/LinkUseCase.js
index b8ed719..89412c5 100644
--- a/src/background/usecases/link.js
+++ b/src/background/usecases/LinkUseCase.js
@@ -1,7 +1,7 @@
-import SettingRepository from '../repositories/setting';
-import TabPresenter from '../presenters/tab';
+import SettingRepository from '../repositories/SettingRepository';
+import TabPresenter from '../presenters/TabPresenter';
-export default class LinkInteractor {
+export default class LinkUseCase {
constructor() {
this.settingRepository = new SettingRepository();
this.tabPresenter = new TabPresenter();
diff --git a/src/background/usecases/mark.js b/src/background/usecases/MarkUseCase.js
index 34b8a74..39c796b 100644
--- a/src/background/usecases/mark.js
+++ b/src/background/usecases/MarkUseCase.js
@@ -1,14 +1,14 @@
-import GlobalMark from '../domains/global-mark';
-import TabPresenter from '../presenters/tab';
-import MarkRepository from '../repositories/mark';
-import ConsolePresenter from '../presenters/console';
-import ContentMessageClient from '../infrastructures/content-message-client';
+import GlobalMark from '../domains/GlobalMark';
+import TabPresenter from '../presenters/TabPresenter';
+import MarkRepository from '../repositories/MarkRepository';
+import ConsoleClient from '../infrastructures/ConsoleClient';
+import ContentMessageClient from '../infrastructures/ContentMessageClient';
-export default class MarkInteractor {
+export default class MarkUseCase {
constructor() {
this.tabPresenter = new TabPresenter();
this.markRepository = new MarkRepository();
- this.consolePresenter = new ConsolePresenter();
+ this.consoleClient = new ConsoleClient();
this.contentMessageClient = new ContentMessageClient();
}
@@ -23,7 +23,7 @@ export default class MarkInteractor {
let mark = await this.markRepository.getMark(key);
if (!mark) {
- return this.consolePresenter.showError(current.id, 'Mark is not set');
+ return this.consoleClient.showError(current.id, 'Mark is not set');
}
return this.contentMessageClient.scrollTo(
diff --git a/src/background/usecases/operation.js b/src/background/usecases/OperationUseCase.js
index ed64032..1d75d1a 100644
--- a/src/background/usecases/operation.js
+++ b/src/background/usecases/OperationUseCase.js
@@ -1,5 +1,5 @@
-import TabPresenter from '../presenters/tab';
-import ConsolePresenter from '../presenters/console';
+import TabPresenter from '../presenters/TabPresenter';
+import ConsoleClient from '../infrastructures/ConsoleClient';
import * as urls from '../../shared/urls';
const ZOOM_SETTINGS = [
@@ -7,10 +7,10 @@ const ZOOM_SETTINGS = [
1.10, 1.25, 1.50, 1.75, 2.00, 2.50, 3.00
];
-export default class OperationInteractor {
+export default class OperationUseCase {
constructor() {
this.tabPresenter = new TabPresenter();
- this.consolePresenter = new ConsolePresenter();
+ this.consoleClient = new ConsoleClient();
}
async close(force) {
@@ -134,7 +134,7 @@ export default class OperationInteractor {
async showCommand() {
let tab = await this.tabPresenter.getCurrent();
- return this.consolePresenter.showCommand(tab.id, '');
+ return this.consoleClient.showCommand(tab.id, '');
}
async showOpenCommand(alter) {
@@ -143,7 +143,7 @@ export default class OperationInteractor {
if (alter) {
command += tab.url;
}
- return this.consolePresenter.showCommand(tab.id, command);
+ return this.consoleClient.showCommand(tab.id, command);
}
async showTabopenCommand(alter) {
@@ -152,7 +152,7 @@ export default class OperationInteractor {
if (alter) {
command += tab.url;
}
- return this.consolePresenter.showCommand(tab.id, command);
+ return this.consoleClient.showCommand(tab.id, command);
}
async showWinopenCommand(alter) {
@@ -161,13 +161,13 @@ export default class OperationInteractor {
if (alter) {
command += tab.url;
}
- return this.consolePresenter.showCommand(tab.id, command);
+ return this.consoleClient.showCommand(tab.id, command);
}
async showBufferCommand() {
let tab = await this.tabPresenter.getCurrent();
let command = 'buffer ';
- return this.consolePresenter.showCommand(tab.id, command);
+ return this.consoleClient.showCommand(tab.id, command);
}
async showAddbookmarkCommand(alter) {
@@ -176,17 +176,17 @@ export default class OperationInteractor {
if (alter) {
command += tab.title;
}
- return this.consolePresenter.showCommand(tab.id, command);
+ return this.consoleClient.showCommand(tab.id, command);
}
async findStart() {
let tab = await this.tabPresenter.getCurrent();
- return this.consolePresenter.showFind(tab.id);
+ return this.consoleClient.showFind(tab.id);
}
async hideConsole() {
let tab = await this.tabPresenter.getCurrent();
- return this.consolePresenter.hide(tab.id);
+ return this.consoleClient.hide(tab.id);
}
async openHome(newTab) {
diff --git a/src/background/usecases/setting.js b/src/background/usecases/SettingUseCase.js
index 656fc3f..fe3ca5d 100644
--- a/src/background/usecases/setting.js
+++ b/src/background/usecases/SettingUseCase.js
@@ -1,8 +1,9 @@
-import Setting from '../domains/setting';
-import PersistentSettingRepository from '../repositories/persistent-setting';
-import SettingRepository from '../repositories/setting';
+import Setting from '../domains/Setting';
+// eslint-disable-next-line max-len
+import PersistentSettingRepository from '../repositories/PersistentSettingRepository';
+import SettingRepository from '../repositories/SettingRepository';
-export default class SettingInteractor {
+export default class SettingUseCase {
constructor() {
this.persistentSettingRepository = new PersistentSettingRepository();
this.settingRepository = new SettingRepository();
diff --git a/src/background/usecases/version.js b/src/background/usecases/VersionUseCase.js
index a71f90d..704c808 100644
--- a/src/background/usecases/version.js
+++ b/src/background/usecases/VersionUseCase.js
@@ -1,9 +1,9 @@
import manifest from '../../../manifest.json';
-import VersionRepository from '../repositories/version';
-import TabPresenter from '../presenters/tab';
-import Notifier from '../infrastructures/notifier';
+import VersionRepository from '../repositories/VersionRepository';
+import TabPresenter from '../presenters/TabPresenter';
+import Notifier from '../infrastructures/Notifier';
-export default class VersionInteractor {
+export default class VersionUseCase {
constructor() {
this.versionRepository = new VersionRepository();
this.tabPresenter = new TabPresenter();