1

I am trying to make a private extension, and I need to save a Boolean value. I am currently using the chrome storage api to do so, but I cannot get the value in the content script. When I log the value to the console it is correct, but when I save it to a variable, it is undefined.

I have tried

var running;
chrome.storage.local.get('running', assignRunning); 

function assignRunning(values) {
    running = values['running'];
    console.log(values);
}

and I have tried to just return the value

var running = chrome.storage.local.get('running', function(x) { return x.running });

Does anyone have any idea what I am doing wrong?

Pete
  • 333
  • 1
  • 12

0 Answers0