我正在尝试检查存储是否为空,但是在数据存储空前甚至可以set
之前,它会提示数据需要get
。
chrome.storage.sync.get('pos', function(r){
if (typeof r.pos === undefined ){
}
})
编辑:我得到的错误是:Invocation of form get(string) doesn't match definition get(optional string or array or object keys, function callback)
at normalizeArgumentsAndValidate (extensions::schemaUtils:112:11)
at StorageArea.self.(anonymous function) [as get] (extensions::StorageArea:35:14)
at chrome-extension://lqhqq.....
这是一个类似的问题:Making an Array in chrome.storage and retrieving data