I just started building a Chrome extension, but I'm not sure how everything works. I want to get a string of data in one method (getTabs) and then return it to the method that called it. This code calls getTabs which creates a string and tries to return it.
function emailTabs() {
chrome.tabs.getAllInWindow(null, getTabs);
console.log(data); //this is never able to access the string
}
function getTabs(tabs) {
var data='';
//build up data...
console.log(data); //this works when there's no anonymous function
return data;
}
How do I get that string back in the emailTabs?