Get all keys from Chrome Storage

后端 未结 1 1339
误落风尘
误落风尘 2020-12-29 02:21

I can get the value of a storage key with the Chrome Extension API:

chrome.storage.sync.get(\"someKey\", function() {}         


        
相关标签:
1条回答
  • 2020-12-29 02:49

    From the documentation (emphasis mine):

    An empty list or object will return an empty result object. Pass in null to get the entire contents of storage. Don't forget to change "storage.sync" to storage.local if you're using local storage.

    For some example code:

    chrome.storage.sync.get(null, function(items) {
        var allKeys = Object.keys(items);
        console.log(allKeys);
    });
    
    0 讨论(0)
提交回复
热议问题