diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-02-04 09:44:01 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-04 09:44:01 +0900 |
commit | 5cb6b5f76aa0bbd731aaeff1e1d76a6b59135fa8 (patch) | |
tree | 75d556081f42b0e6f374e4993355792f5f8e5591 /src/background/usecases/operation.js | |
parent | 6282204fc64902232b8a8cb181b2eadb0f8097bf (diff) | |
parent | 54bbe4ecbdb53dddd97db18581edb0704b4cb76f (diff) |
Merge pull request #516 from ueokande/close-tabs-to-the-right
Add close tabs to the right command
Diffstat (limited to 'src/background/usecases/operation.js')
-rw-r--r-- | src/background/usecases/operation.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/background/usecases/operation.js b/src/background/usecases/operation.js index bf905be..dd24e75 100644 --- a/src/background/usecases/operation.js +++ b/src/background/usecases/operation.js @@ -21,6 +21,21 @@ 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) { + let tab = tabs[i]; + if (!tab.pinned) { + this.tabPresenter.remove(tab.id); + } + } + } + reopen() { return this.tabPresenter.reopen(); } |