lundi 4 juillet 2016

Is there a way of assigning variables into chrome.storage.local separately?

I am new to Chrome extension developing. As far as I know, the chrome.storage.local.set can only set an object as a whole. The only way I can find of assigning an object to storage.local is as below:

chrome.storage.local.set({ key : value }, function() {
  console.log("Object set.");
});

When I use "get" method to retrieve the saved data I get this one only. And every time when I set a new object to storage.local, it updates the previously stored data. However, I wanna write a function that allows me to add a new object to the storage object, like:

{
  {subObject1: value},
  {subObject2: value},
  {subObject3: value},
  ...
}

How can I do that? Huge thanks in advance!




Aucun commentaire:

Enregistrer un commentaire