Reputation: 1
It worked a moment ago and now I'm unable to get into the callback of chrome.storage.local.get().
I have data in the local store and I've written it correctly.
Why does it fail? Do I missunderstand something or am I missing something?
chrome.storage.sync.get("wortlisteOptionId", function(result){
if(result["wortlisteOptionId"] != "" && result["wortlisteOptionId"] !== undefined){
var prevSelection = result["wortlisteOptionId"];
}
var item = document.getElementById('wortlisten');
// works till here
chrome.storage.local.get("wortlisten", function(result)
{
let val;
let optioncollection = "";
if(result["wortlisten"] != null){
for(val of result["wortlisten"]){
optioncollection += '<option value="' + val.id + '">' + val.name + '</option>';
}
item.innerHTML = optioncollection;
if(prevSelection != null){
item.selectedIndex = prevSelection;
}
restoreLocalData();
}
});
});
Upvotes: 0
Views: 122
Reputation: 1
I'm not sure what caused this problem. My best guess is, that I testet it with xampp on my local machine and the performance was horrible. After I tested it with my productive envirement, I haven't got that issue....
On my way I found also this page with some explenation: Returning Chrome storage API value without function
Upvotes: 0