From 4445309334e309c7ad74ec2011d40c6998fd4653 Mon Sep 17 00:00:00 2001 From: João Vitor Brandão Date: Thu, 24 May 2018 17:14:19 -0300 Subject: Adds command to close all tabs Type :qa or :quitall to close all tabs --- src/background/actions/command.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/background/actions/command.js') diff --git a/src/background/actions/command.js b/src/background/actions/command.js index f1ee5b5..6d83450 100644 --- a/src/background/actions/command.js +++ b/src/background/actions/command.js @@ -27,6 +27,14 @@ const tabcloseCommand = () => { }); }; +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 }); }; @@ -117,6 +125,9 @@ const exec = (tab, line, settings) => { case 'q': case 'quit': return tabcloseCommand(); + case 'qa': + case 'quitall': + return tabcloseAllCommand() case '': return Promise.resolve(); } -- cgit v1.2.3