How do I call chrome.storage.sync.get and assign variables on page load?
<p>I have a page that should only load a certain portion if a setting is true. These settings are found in storage.</p>

<p>However I am unable to retrieve these settings when loading the page.<br>
I have tried the following:</p>

<pre><code>var permission = true;
chrome.storage.sync.get({ 
    history: true
}, function(items) {
    permission = items.history;
});
</code></pre>

<p>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.</p>

<p>I call this function as well as the functions loading the parts of the page using</p>

<pre><code>document.addEventListener('DOMContentLoaded', function () {
</code></pre>

<p>I think the problem is that the function is not called in time, but I don't know how to resolve this.</p>