From b9bf74fc6c02afed77da3ec991f8ac5da6687842 Mon Sep 17 00:00:00 2001 From: ilya Date: Sun, 28 Mar 2010 17:43:53 -0700 Subject: Fix chaining of previousTab/nextTab commands. This closes #93. --- background_page.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'background_page.html') 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; } -- cgit v1.2.3