aboutsummaryrefslogtreecommitdiff
path: root/src/background/tabs.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/background/tabs.js')
-rw-r--r--src/background/tabs.js28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/background/tabs.js b/src/background/tabs.js
index 617909e..efecdc4 100644
--- a/src/background/tabs.js
+++ b/src/background/tabs.js
@@ -1,9 +1,9 @@
const closeTab = (id) => {
- browser.tabs.remove(id);
+ return browser.tabs.remove(id);
};
const reopenTab = () => {
- browser.sessions.getRecentlyClosed({
+ return browser.sessions.getRecentlyClosed({
maxResults: 1
}).then((sessions) => {
if (sessions.length === 0) {
@@ -11,15 +11,15 @@ const reopenTab = () => {
}
let session = sessions[0];
if (session.tab) {
- browser.sessions.restore(session.tab.sessionId);
+ return browser.sessions.restore(session.tab.sessionId);
} else {
- browser.sessions.restore(session.window.sessionId);
+ return browser.sessions.restore(session.window.sessionId);
}
});
};
const selectAt = (index) => {
- chrome.tabs.query({ currentWindow: true }, (tabs) => {
+ return browser.tabs.query({ currentWindow: true }, (tabs) => {
if (tabs.length < 2) {
return;
}
@@ -27,12 +27,12 @@ const selectAt = (index) => {
throw new RangeError(`tab ${index} does not exist`)
}
let id = tabs[index].id;
- chrome.tabs.update(id, { active: true })
+ return browser.tabs.update(id, { active: true })
});
};
const selectByKeyword = (keyword) => {
- chrome.tabs.query({ currentWindow: true }, (tabs) => {
+ return browser.tabs.query({ currentWindow: true }).then((tabs) => {
let matched = tabs.filter((t) => {
return t.url.includes(keyword) || t.title.includes(keyword)
})
@@ -43,34 +43,34 @@ const selectByKeyword = (keyword) => {
throw new RangeError('More than one match for ' + keyword);
}
- chrome.tabs.update(matched[0].id, { active: true });
- })
+ return browser.tabs.update(matched[0].id, { active: true });
+ });
}
const selectPrevTab = (current, count) => {
- chrome.tabs.query({ currentWindow: true }, (tabs) => {
+ return browser.tabs.query({ currentWindow: true }, (tabs) => {
if (tabs.length < 2) {
return;
}
let select = (current - count) % tabs.length
let id = tabs[select].id;
- chrome.tabs.update(id, { active: true })
+ return browser.tabs.update(id, { active: true })
});
};
const selectNextTab = (current, count) => {
- chrome.tabs.query({ currentWindow: true }, (tabs) => {
+ return browser.tabs.query({ currentWindow: true }, (tabs) => {
if (tabs.length < 2) {
return;
}
let select = (current + count + tabs.length) % tabs.length
let id = tabs[select].id;
- chrome.tabs.update(id, { active: true })
+ return browser.tabs.update(id, { active: true })
});
};
const reload = (current, cache) => {
- browser.tabs.reload(
+ return browser.tabs.reload(
current.id,
{ bypassCache: cache }
);