it's my first chrome extension and I'm trying to send a set from content.js to popup.js . I tried using sendMessage and chrome.storage.local but I can't get it to work. this is how I set the data in content.js, I do it inside a chrome.runtime.onMessage.addListener since the user needs to input some data and then click on a button:
chrome.storage.local.set({dataset: accountSet});
the popup.js:
chrome.storage.local.get("dataset", function(data) {
if(typeof data.dataset == "undefined") {
//bad
} else {
data.dataset.forEach(function(value) {
//do smthg
});
document.getElementById("accounts-tab").innerHTML+='</table>';
}
});
I'm using manifest_version 3, thank you.