Merge pull request #402 from jvbrandaom/quit-all-command
Adds command to close all tabs
This commit is contained in:
commit
9f64b19bef
2 changed files with 16 additions and 1 deletions
|
@ -131,10 +131,14 @@ To adjust the search engine default and add/remove search engines, see the [sear
|
|||
|
||||
Open a URL or search keywords by search engine in new tab.
|
||||
|
||||
#### `:quit` command
|
||||
#### `:quit` or `:q` command
|
||||
|
||||
Close the current tab.
|
||||
|
||||
#### `:quitall` or `:qa` command
|
||||
|
||||
Close all tabs.
|
||||
|
||||
#### `:bdelete` command
|
||||
|
||||
Close a certain tab.
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Reference in a new issue