function getBugVal() {
var bugVal = "";
chrome.storage.sync.get('bugId', function (obj) {
console.log(obj.bugId);
bugVal = obj.bugId;
console.log(bugVal + "<- val inside get sync");
});
console.log(bugVal + "<- val outside get sync");
return bugVal;
}
If I call getBugVal() the return value keeps indicating an empty string instead of the actual value from the chrome.storage.sync.get. bugVal is not even saving the string value.
console.log(bugVal + "<- val inside get sync");
yields the correct value within the inner function call. Thoughts?