javascript - Using chrome.storage.get to get a variable -
i'm making little chrome extension , have used options page use chrome.storage.sync.set set variable pws. however, on pop-up page cannot retrieve variable , use in string. here code goes:
weather.open("get", "http://api.wunderground.com/api/"+wu_api_key+"/conditions/q/ca/pws:"+pws+".json", true); weather.send() })
how pws in there variable chrome.sync.storage.get?
i tried
chrome.storage.sync.get(pws, function(result){ var pws = result.pws console.debug('result:',pws); });
but no avail.
if use "pws"
key store pws
, could:
chrome.storage.sync.get("pws", function(result) { var pws = result.pws; console.log("result:", pws); });
Comments
Post a Comment