everyone.
I've got a chrome.storage.local.get
function that is supposed to accept objects that have already been set up to the local memory. It's structured something like...
let numberOfRows = 3; //The number of generic rows of this information I'll need
let storageIDs = []; //The keys for the object that I'll need.
let storageArray = storageIDs.slice(0); //The default keys I need I'll number if I need to
let storageObject = {}; //The final object will be stored in here
for(...) {//Fill the storageArray with each key (number appended) at the end}
for(...) {//Turn each finalized key into an object stored in an storageObject}
chrome.storage.local.get({
(function(){
for(let index in storageObject) {
if (storageObject.hasOwnProperty(index)) {
return storageObject[index];
}
}
})()
}, function (result) {...}
So... The end result is that I'll set the number of rows and pass in an array of keys, and then it'll turn each of those into an object reference to the chrome local storage.
But I don't want to call storage.local.get
more than once, so I'm wondering if it's possible to return each object inside of storageObject
inside of the argument list? Or is there a simpler way to get all of the objects inside of storageObject
passed in as arguments?
Edit:
chrome.storage.local.get
is expecting a set of objects, "keyValue1": {}, "keyValue2": {}
and so on.
When it passes those objects into result
, I can call them back as result["keyValue1"]
, but if I put in my object that has all of the keys in it, I can only call back that object.
What I need is a way to dynamically pass in all of the properties of storageObject
without calling chrome.storage.local.get()
more than once.