Hopefully, the title is self-explanatory. Basically I'm injecting two scripts on my popup.js and I want to expose a variable defined on one of them so the other script can use it.
This is the way I'm injecting the scripts:
let sortFunction = function (goSortParam) {
    if (goSortParam) {
      chrome.tabs.executeScript(
        null,
        { code: 'var goSortParam=true;' },
        function () {
          chrome.tabs.executeScript(null, { file: 'scripts/ajaxCalls.js' });
          chrome.tabs.executeScript(null, { file: 'scripts/frontEndDev.js' });
        }
      );
    } else {
      chrome.tabs.executeScript(
        null,
        { code: 'var goSortParam=false;' },
        function () {
          chrome.tabs.executeScript(null, { file: 'scripts/frontEndDev.js' });
        }
      );
    }
  };
This is the ajaxCalls.js:
const CONFIG_URL = chrome.extension.getURL('./data/config.json');
const promise = fetch(CONFIG_URL);
promise
  .then(function (response) {
    const processingPromise = response.json();
    return processingPromise;
  })
  .then(function (processedResponse) {
    const configData = processedResponse;
    console.log(configData.tags);
  });
The variable I want to expose is "configData" so "frontEndDev.js" can use it. Any ideas will be very welcome.
 
    