title: How to use chrome storage on a chrome extension?
body: <p>I'm creating a chrome extension to store the texts highlighted by the user and turn it available on the popup of the extension.
  I'm trying to store the highlight texts (strings) in the chrome storage with sync or local, and then get it in the popup.
  Also, I created an array to store the strings.</p>
  
  <p>Any suggestion or best practice to do that, using chrome storage?
  Or is better to do it through messaging? (sending the array of strings to popup)</p>
  
  <p>Manifest.json</p>
  
  <pre><code>    {
    "manifest_version": 2,
    "name": "Information Hoover",
    "version": "0.1",
    "description": "Grab and store knowledge around the web",
    "permissions": ["activeTab", "tabs", "declarativeContent", "storage", "contextMenus"],
    "background": {
      "scripts": ["background.js"]
    },
    "browser_action": {
      "default_popup": "popup.html",
      "default_title": "get highlighted text"
    },
  
    "content_scripts": [
      {
        "matches": [
          "&lt;all_urls&gt;"
        ],
        "js": ["content.js"]
      }
    ]
  }
  </code></pre>
  
  <p>Content.js</p>
  
  <pre><code>
  let texts = [];
  
  window.addEventListener('mouseup', getSelectionText);
  
  function getSelectionText(){
    let selectedText = window.getSelection().toString();
  
      if (selectedText.length &gt; 0){ // check there's some text selected
  
        let message = {
          text: selectedText
        };
        //chrome.runtime.sendMessage(message);
  
        texts.push(selectedText);
  
        console.log(message);
      }      
  }
  </code></pre>
  
  <p>Background.js</p>
  
  <pre><code>chrome.runtime.onMessage.addListener(receiver);
  
  let highlightedTexts = [];
  
  function receiver(request, sender, sendResponse) {
    sentence = request.text;
    highlightedTexts.push(sentence);
  
    console.log(highlightedTexts);
  }
  </code></pre>
  
  <p>popup.js</p>
  
  <pre><code>function setup() {
    let bgpage = chrome.extension.getBackgroundPage();
    let texts = [];
    let word = bgpage.sentence;
    texts.push(word);
  
    document.querySelector('.selectedtext').innerHTML = word;
    console.log(texts);
  }
  
  setup();
  </code></pre>
  
  <p>popup.html</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;  
  &lt;html lang="en"&gt;  
    &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
      &lt;meta http-equiv="X-UA-Compatible" content="ie=edge"&gt;
      &lt;title&gt;Document&lt;/title&gt;  
      &lt;link rel="stylesheet" type="text/css" href="styles.css"&gt;  
    &lt;/head&gt;  
    &lt;body&gt; 
      &lt;div class="selected-text-area"&gt;
          &lt;p class="selectedtext"&gt; &lt;/p&gt; 
      &lt;/div&gt;
  
      &lt;script src="popup.js"&gt;&lt;/script&gt;  
    &lt;/body&gt;  
  &lt;/html&gt; 
  </code></pre>