从Chrome存储中获取所有密钥 [英] Get all keys from Chrome Storage
本文介绍了从Chrome存储中获取所有密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以通过Chrome扩展程序API获得存储密钥的价值:
$ b
I can get the value of a storage key with the Chrome Extension API:
chrome.storage.sync.get("someKey", function() {});
如何获取Chrome存储中存在的所有关键字名称?
How can I get all key names that exist in the Chrome storage?
推荐答案
从文档(强调我的):
From the documentation (emphasis mine):
空的列表或对象将返回一个空的结果对象。 传入
null
即可获取整个存储内容。
An empty list or object will return an empty result object. Pass in
null
to get the entire contents of storage.
对于一些示例代码:
For some example code:
chrome.storage.sync.get(null, function(items) {
var allKeys = Object.keys(items);
console.log(allKeys);
});
这篇关于从Chrome存储中获取所有密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文