diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-09-17 08:59:12 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-09-17 08:59:12 +0900 |
commit | 9ae814dfe45426f8df9b89b305392770344a7d50 (patch) | |
tree | db082d9cb2ec426010556dbc24ab439c9757afbd /src/background/tabs.js | |
parent | c5529958d53146c8c6826673abe6431a19f1924d (diff) |
more strict lint
Diffstat (limited to 'src/background/tabs.js')
-rw-r--r-- | src/background/tabs.js | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/background/tabs.js b/src/background/tabs.js index bd69b4b..32f71ba 100644 --- a/src/background/tabs.js +++ b/src/background/tabs.js @@ -12,9 +12,8 @@ const reopenTab = () => { let session = sessions[0]; if (session.tab) { return browser.sessions.restore(session.tab.sessionId); - } else { - return browser.sessions.restore(session.window.sessionId); } + return browser.sessions.restore(session.window.sessionId); }); }; @@ -24,20 +23,20 @@ const selectAt = (index) => { return; } if (index < 0 || tabs.length <= index) { - throw new RangeError(`tab ${index} does not exist`) + throw new RangeError(`tab ${index} does not exist`); } let id = tabs[index].id; - return browser.tabs.update(id, { active: true }) + return browser.tabs.update(id, { active: true }); }); }; const selectByKeyword = (current, keyword) => { return browser.tabs.query({ currentWindow: true }).then((tabs) => { let matched = tabs.filter((t) => { - return t.url.includes(keyword) || t.title.includes(keyword) - }) + return t.url.includes(keyword) || t.title.includes(keyword); + }); - if (matched.length == 0) { + if (matched.length === 0) { throw new RangeError('No matching buffer for ' + keyword); } for (let tab of matched) { @@ -47,13 +46,13 @@ const selectByKeyword = (current, keyword) => { } return browser.tabs.update(matched[0].id, { active: true }); }); -} +}; const getCompletions = (keyword) => { return browser.tabs.query({ currentWindow: true }).then((tabs) => { let matched = tabs.filter((t) => { - return t.url.includes(keyword) || t.title.includes(keyword) - }) + return t.url.includes(keyword) || t.title.includes(keyword); + }); return matched; }); }; @@ -63,9 +62,9 @@ const selectPrevTab = (current, count) => { if (tabs.length < 2) { return; } - let select = (current - count) % tabs.length + let select = (current - count) % tabs.length; let id = tabs[select].id; - return browser.tabs.update(id, { active: true }) + return browser.tabs.update(id, { active: true }); }); }; @@ -74,9 +73,9 @@ const selectNextTab = (current, count) => { if (tabs.length < 2) { return; } - let select = (current + count + tabs.length) % tabs.length + let select = (current + count + tabs.length) % tabs.length; let id = tabs[select].id; - return browser.tabs.update(id, { active: true }) + return browser.tabs.update(id, { active: true }); }); }; @@ -87,4 +86,7 @@ const reload = (current, cache) => { ); }; -export { closeTab, reopenTab, selectAt, selectByKeyword, getCompletions, selectPrevTab, selectNextTab, reload }; +export { + closeTab, reopenTab, selectAt, selectByKeyword, getCompletions, + selectPrevTab, selectNextTab, reload +}; |