I’m trying to get some values from local storage but I can’t figure out how to return a value from a promise. I would like to have the storage getter inside a function so I can call it when needed, everything I try results in a pending state from the promise. I tried using resolve but I’m not sure if it works like this.
function getter() {
var get = browser.storage.local.get().then(storage => {
resolve(storage);
}, onError);
return get;
}
console.log(getter());