diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-12-27 19:17:07 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-12-27 19:49:48 +0900 |
commit | c03ab2862bf1fe015a0f7e9d9baf6738d639d425 (patch) | |
tree | 20c7ef6949e9c5d03d0ec89aec3d2664fc76747e /src/background/usecases | |
parent | 1fc44c783aec2f155307b2de484c204cf39cbff1 (diff) |
Add close tabs to the right command
Diffstat (limited to 'src/background/usecases')
-rw-r--r-- | src/background/usecases/operation.js | 12 |
1 files changed, 12 insertions, 0 deletions
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(); } |