Reputation: 147
Basically, there is a stored primitive I would like to set as a value of a jQuery UI Tab setting:
$("#tabs").tabs({
active: chrome.storage.local.get("idx", function(obj){
console.log(obj["idx"])}); // returns primitive integer I want.
}), ...
});
The standard chrome-storage-get protocol is quite convoluted and I am unsure how I can simply set the object property value itself to be the value of active:
rather than the object.
active: 3 // chrome.storage.local.get("idx")
Any way to do this?
Upvotes: 0
Views: 95
Reputation: 7273
chrome.storage
is asynchronous, so your code would look more like this:
chrome.storage.local.get("idx", function(obj) {
$("#tabs").tabs({
active: obj.idx
});
});
Upvotes: 2