I want to get 2 values from chrome storage via chrome.storage.local.get() but if I try to return the values from the callback function, I get 'undefined'. If I console.log() them, they are actually logged. Why is that? I've read in some other posts, that I need to use a callback - but as far as my basic JS understanding goes, I already return the value from the callback frunction of get().
// this should load 2 keys from an object stored in chrome storage
function loadJiraUrlElements(){
chrome.storage.local.get({companyName: '', jiraBaseUrl: ''}, function(items) {
return (items.companyName + items.jiraBaseUrl);
})
}
// I want to use this function to call the return value and populate a DOM element
function populateUrlFieldsWithUrlElements(){
companyInput.value = loadJiraUrlElements()
}