Get & Set Object items - chrome.storage


chrome.storage.local.get(null, function(keys) {
  console.log(keys); //Get object with all keys from storage
});

安慰:对象 { 项目1: { a: "data1a", b:"data1b" } 项目2: { a: "data2a", b: "data2b" } }

现在,我想从对象中删除item1并使用chrome.storage.local.set()将其保存回来;

我可以删除键"item1"的值,例如a和b。如何删除键"item1"本身?

chrome.storage.local.remove('item1'); //delete key in an object

文档:https://developer.chrome.com/extensions/storage

最新更新