aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--background_page.html7
1 files changed, 4 insertions, 3 deletions
diff --git a/background_page.html b/background_page.html
index 90e3a410..0bed6594 100644
--- a/background_page.html
+++ b/background_page.html
@@ -273,13 +273,13 @@
chrome.tabs.create({}, function(tab) { callback(); });
}
- function nextTab() { selectTab("next"); }
- function previousTab() { selectTab("previous"); }
+ function nextTab(callback) { selectTab(callback, "next"); }
+ function previousTab(callback) { selectTab(callback, "previous"); }
/*
* Selects a tab before or after the currently selected tab. Direction is either "next" or "previous".
*/
- function selectTab(direction) {
+ function selectTab(callback, direction) {
chrome.tabs.getAllInWindow(null, function(tabs) {
if (tabs.length <= 1)
return;
@@ -287,6 +287,7 @@
if (tabs[i].selected) {
var delta = (direction == "next") ? 1 : -1;
var toSelect = tabs[(i + delta + tabs.length) % tabs.length];
+ selectionChangedHandlers.push(callback);
chrome.tabs.update(toSelect.id, { selected: true });
break;
}