I am having a problem because chrome api functions are async and I cant get its return value. Consider the following code. I am using angularjs
$scope.storageGet = function(param) {
var returnData;
chrome.storage.local.get(param.storageName, function(data) {
returnData = data;
});
return returnData;
};
And when I tried to call it like this:
console.log($scope.storageGet({'storageName': 'users'}));
It prints 'undefined' in the console. What I want to see is the obect of users stored in chrome storage. Well, I'm sure that I have data in chrome storage.