1
chrome.runtime.onInstalled.addListener{
let urlobj={}
chrome.storage.sync.set(urlobj}

chrome.alarms.create("everyDay",{when:Date.now(),periodInMinutes:1})
chrome.alarms.onAlarm.addListener((alarm)=>{
        chrome.storage.sync.get(urlobj,(data)=>{
            console.log("is reading urlobj"+data)
        })
)

I run on chrome,the devtool say that Error in event handler: ReferenceError: urlobj is not definederro at chrome.storage.sync.get(urlobj).How can read the storage?And why i cannot see storage in devtool?

cod002
  • 31
  • 4
  • 1) Remove `urlobj`, remove the useless set() call, and use `data` inside your callback of get() as shown [here](https://stackoverflow.com/questions/23667086/why-is-my-variable-unaltered-after-i-modify-it-inside-of-a-function-asynchron). 2) [Inspect extension's chrome.storage in devtools](https://stackoverflow.com/q/32435399) – wOxxOm Apr 12 '22 at 06:53

0 Answers0