I have a page that should only load a certain portion if a setting is true. These settings are found in storage.
However I am unable to retrieve these settings when loading the page.
I have tried the following:
var permission = true;
chrome.storage.sync.get({
history: true
}, function(items) {
permission = items.history;
});
but permission will always equal true when the page loads. If I put a call to another function to print the value of permission, this will not be called until after.
I call this function as well as the functions loading the parts of the page using
document.addEventListener('DOMContentLoaded', function () {
I think the problem is that the function is not called in time, but I don't know how to resolve this.