samedi 6 novembre 2021

Can't change value of varible in chrome.local.get() in Chrome Extension

My function is

var value = 0;
chrome.storage.local.get(["color_code"], function(data) {
            alert(data["color_code"]);
            //localStorage.setItem("color_value",data["color_code"]);
});
value = localStorage.getItem("color_value");

But in my extension the value varible still be 0 after call but the data["color_code"] is 2

Aucun commentaire:

Enregistrer un commentaire