I'm trying to integrate chrome's storage into my extension. And I'm having trouble grasping how the data is stored once it's written because nothing I try seems to work. What I want to be able to do is store an object with a specific key. But that key is generated runtime, dynamically.
So I have something like this so far.
let storage = {};
storage["status"] = "no status";
chrome.storage.local.set(storage,function(){
});
When I do that, the key automatically becomes 'storage' but I don't want to do that. Because I want the key to be unique every time. So ideally what I want to do is this
let storageid = generateid();//generate unique storage id
let storage = {};
storage["status"] = "no status";
chrome.storage.local.set({storageid: storage},function(){
});
But even in that instance the key is still "storageid" not necessarily the value held in the variable storageid. It's a bit tricky to explain the problem because of my little understanding of how chrome's local storage works. So any help would be greatly appreciated.