Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

271
Visualizações
chrome.runtime.onMessage.addListener is not responding

I saved a variable in key: data Console.log(data.key), gives me out my data.

But now I send a message to the background.js from my popup.js and it doesnt read line:

sendResponse(data.key);

result = undefined, I tried to move it out of chrome.storage.local.get("key", function(data) { }) and it worked with a test variable.

Popup.js:

chrome.runtime.sendMessage({from: 'popup',subject: 'ubisoft'}, function (result) {

        window.alert(result)
        
      });

Background.js:

  chrome.runtime.onMessage.addListener((msg, sender,sendResponse) => {

    // First, validate the message's structure.
    if ((msg.from === 'popup') && (msg.subject === 'ubisoft')) {
      // Enable the page-action for the requesting tab.
      chrome.storage.local.get("key", function(data) {
        // Do something with data.key
        console.log(data.key)
        sendResponse(data.key);
      });
    }
  });
about 4 years ago · Santiago Gelvez
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda