Chrome Extension: query tabs async
问题 I have two variables being set to the "return value" of functions, these functions are to get the URL of a tab, and a reference to the actual tab object, and store them in variables. I have some code: function init(){ var url = getUrl(); var tab = getTab(); } function getUrl(){ var tablink; chrome.tabs.query({currentWindow: true, active: true},function(tabs){ tablink = tabs[0].url; return tablink; }); } function getTab(){ var tab; chrome.tabs.query({currentWindow: true, active: true},function