Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/381.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用chrome.storage.sync获取数据_Javascript_Google Chrome_Google Chrome Extension_Local Storage - Fatal编程技术网

Javascript 使用chrome.storage.sync获取数据

Javascript 使用chrome.storage.sync获取数据,javascript,google-chrome,google-chrome-extension,local-storage,Javascript,Google Chrome,Google Chrome Extension,Local Storage,如何从中获取数据 chrome.storage.sync.get 把他的值存储在一个变量上? 我一直在chrome extension中创建一个CRUD,但是当尝试Retrieve数据时,它看起来像chrome.storage.sync.get不返回数据 const STORAGE=chrome.STORAGE.sync; 函数getURLs(){ 让URL=[]; STORAGE.get([“url”],result=>{ URL=result.url | |[]; }); 返回URL; }

如何从中获取数据

chrome.storage.sync.get
把他的值存储在一个变量上? 我一直在chrome extension中创建一个CRUD,但是当尝试Retrieve数据时,它看起来像
chrome.storage.sync.get
不返回数据

const STORAGE=chrome.STORAGE.sync;
函数getURLs(){
让URL=[];
STORAGE.get([“url”],result=>{
URL=result.url | |[];
});
返回URL;
}
有什么帮助吗?

感谢您将此答案格式化。此答案很有用,但仍然找不到正确的答案。谢谢你的关注。已经找到了答案,非常感谢你成为代码英雄!!感谢您将此答案格式化。此答案很有用,但仍然找不到正确的答案。谢谢你的关注。已经找到了答案,非常感谢你成为代码英雄!!