title: Chrome Extension: Can I send multiple send messages from content script?
body: <p><strong>TLDR</strong>: I want data that was prepared in <code>content.js</code> to be available in <code>popup.js</code> so that when I click on it I can render it.</p>
  <p>Upgrading @wOxxOm's solution he gave in my last question, after having data from <code>background.js</code>, I want to do some operations and want that info back to background.js so that prepared info should be able to send on <code>popup.js</code>. Code looks like below:</p>
  <p><strong>background.js</strong></p>
  <pre><code>chrome.runtime.onMessage.addListener((request, sender, sendResponse) =&gt; {
      console.log('Message got by Background')
      console.log(request)
      var msg_for_popup = ''
      if(request.from === 'content') {
          getInfo(request.msg).then(sendResponse);
      } else if(request.from === 'popup') {
          //want to send data prepared in content script to popup
          sendResponse('PREPARED DATA = '+msg_for_popup) //EMPTY here
      } else if(request.from === 'prepared') {
          msg_for_popup = request.msg
          console.log('Prepared in BG')
          console.log(msg_for_popup) //Data is here
      }
      
      return true; // keep the channel open for asynchronous sendResponse
  });
  </code></pre>
  <p><strong>content.js</strong></p>
  <pre><code>  chrome.runtime.sendMessage({from:'content',msg:document.location.href}, res =&gt; {
    console.log(res);
    if (res.html) {
      var prepared = 'Prepared'
     chrome.runtime.sendMessage({from:'prepared',msg:'Prepared'}, res =&gt; {                
      });
    }
  });
  </code></pre>
  <p><strong>popup.js</strong></p>
  <pre><code>chrome.runtime.sendMessage({from:'popup',msg:&quot;send info&quot;}, (response) =&gt; {
    console.log(response)
  });
  </code></pre>
  <p>I was willing to avoid storage due to unreliability.</p>