0

I’m new to this so excuse me.

Im storing values inside the chrome storage api using chrome.storage.local in one of my scripts that i run in the popup. how would i get my content script to pull that value from the chrome storage or is this just not possible.

for example:

popup.js

chrome.storage.local.set({‘wins’:value})

contentscript.js

chrome.storage.local.get([‘wins’], function(result) {
    numberwins = result.key
    console.log(‘You have ‘ + result.key); 
});
Kurohige
  • 1,378
  • 2
  • 16
  • 24
James
  • 13
  • 3
  • Replace both `result.key` with `result.wins` – wOxxOm Apr 24 '20 at 04:03
  • thanks it now gets recognized in the logs! if i wanted to assign that value to a variable would i use stringify? – James Apr 24 '20 at 04:19
  • See [Why is my variable unaltered after I modify it inside of a function? - Asynchronous code reference](https://stackoverflow.com/q/23667086) – wOxxOm Apr 24 '20 at 04:54

0 Answers0