Retornar resultado assíncrono e não indefinido
function loadJiraUrlElements() {
return new Promise(function(resolve, reject) {
chrome.storage.local.get({companyName: '', jiraBaseUrl: ''}, function(items) {
resolve(items.companyName + items.jiraBaseUrl);
})
});
}
// And caller function changes to
function populateUrlFieldsWithUrlElements(){
loadJiraUrlElements().then(function(value) {
companyInput.value = value;
})
}
Old-fashioned Ocelot