diff options
author | Luan Nico <luanpotter27@gmail.com> | 2018-02-22 20:14:03 -0300 |
---|---|---|
committer | Luan Nico <luanpotter27@gmail.com> | 2018-02-22 20:14:03 -0300 |
commit | 43079f2c68a3f04b83eed10ee13b7dddab524d24 (patch) | |
tree | a402911dcf4fa2f52467fafbed74cdd305551292 /src/background | |
parent | d0e4fc92ce678fdb18fc27a9810f7fb1c8b8a8f5 (diff) |
implement :q to close tab
Diffstat (limited to 'src/background')
-rw-r--r-- | src/background/actions/command.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/background/actions/command.js b/src/background/actions/command.js index 4c52bca..75d04bf 100644 --- a/src/background/actions/command.js +++ b/src/background/actions/command.js @@ -17,6 +17,12 @@ const tabopenCommand = (url) => { return browser.tabs.create({ url: url }); }; +const tabcloseCommand = () => { + return browser.tabs.query({ active: true }).then((tabList) => { + return browser.tabs.remove(tabList.map(tab => tab.id)); + }); +}; + const winopenCommand = (url) => { return browser.windows.create({ url }); }; @@ -70,6 +76,9 @@ const exec = (line, settings) => { return bufferCommand(args); case 'set': return setCommand(args); + case 'q': + case 'quit': + return tabcloseCommand(); case '': return Promise.resolve(); } |