aboutsummaryrefslogtreecommitdiff
path: root/src/background
diff options
context:
space:
mode:
Diffstat (limited to 'src/background')
-rw-r--r--src/background/controllers/operation.js2
-rw-r--r--src/background/usecases/operation.js12
2 files changed, 14 insertions, 0 deletions
diff --git a/src/background/controllers/operation.js b/src/background/controllers/operation.js
index aea85fc..646f50e 100644
--- a/src/background/controllers/operation.js
+++ b/src/background/controllers/operation.js
@@ -11,6 +11,8 @@ export default class OperationController {
switch (operation.type) {
case operations.TAB_CLOSE:
return this.operationInteractor.close(false);
+ case operations.TAB_CLOSE_RIGHT:
+ return this.operationInteractor.closeRight();
case operations.TAB_CLOSE_FORCE:
return this.operationInteractor.close(true);
case operations.TAB_REOPEN:
diff --git a/src/background/usecases/operation.js b/src/background/usecases/operation.js
index bf905be..74f484e 100644
--- a/src/background/usecases/operation.js
+++ b/src/background/usecases/operation.js
@@ -21,6 +21,18 @@ export default class OperationInteractor {
return this.tabPresenter.remove([tab.id]);
}
+ async closeRight() {
+ let tabs = await this.tabPresenter.getAll();
+ tabs.sort((t1, t2) => t1.index - t2.index);
+ let index = tabs.findIndex(t => t.active);
+ if (index < 0) {
+ return;
+ }
+ for (let i = index + 1; i < tabs.length; ++i) {
+ this.tabPresenter.remove(tabs[i].id);
+ }
+ }
+
reopen() {
return this.tabPresenter.reopen();
}