I have this code below:
function searchQuery() {
var r = 'toReplace';
chrome.storage.sync.get(['search_query'], function(result) {
console.log(result.search_query);
r = result.search_query;
});
return r;
}
I console.log this function somewhere else, and the console.log inside the sync.get function outputs the right thing, but the function itself is "toReplace." Why is this?
storage.syncdoesn't appear to be synchronous. Thesyncstands for "synchronize"