diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-07-01 07:04:05 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-01 07:04:05 +0900 |
commit | 9f64b19bef06328999a5ed602ba89867402b9d5c (patch) | |
tree | 12983c21fdfa1d3a15ea6be5d9874621eb6e6c7c /src | |
parent | d0c23587f8ee8c1bca38f036ae8f71078d6ca937 (diff) | |
parent | 4445309334e309c7ad74ec2011d40c6998fd4653 (diff) |
Merge pull request #402 from jvbrandaom/quit-all-command
Adds command to close all tabs
Diffstat (limited to 'src')
-rw-r--r-- | src/background/actions/command.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/background/actions/command.js b/src/background/actions/command.js index a6e426a..fb8ff98 100644 --- a/src/background/actions/command.js +++ b/src/background/actions/command.js @@ -25,6 +25,14 @@ const tabcloseCommand = async() => { return browser.tabs.remove(got.map(tab => tab.id)); }; +const tabcloseAllCommand = () => { + return browser.tabs.query({ + currentWindow: true + }).then((tabList) => { + return browser.tabs.remove(tabList.map(tab => tab.id)); + }); +}; + const winopenCommand = (url) => { return browser.windows.create({ url }); }; @@ -113,6 +121,9 @@ const exec = (tab, line, settings) => { case 'q': case 'quit': return tabcloseCommand(); + case 'qa': + case 'quitall': + return tabcloseAllCommand() case '': return Promise.resolve(); } |