title: Putting chrome.tabs.query in a function always returns undefined
body: <p>I'm making a Chrome extension that makes a lot of use of getting the id of the current active tab in the current active window. Using chrome.tabs.query wrapped around a lof of logic makes my code messy, but putting it in it's own function to return the current tab always returns undefined - why?</p>
  
  <pre><code>function _getCurrentTab(){
      var theTab;
      chrome.tabs.query({active:true, currentWindow:true},function(tab){
          theTab = tab;
      });
      return theTab;
  };
  console.log(_getCurrentTab());
  </code></pre>
  
  <p>Can anyone help with this?</p>