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

217
Visualizações
Is it necessary to removeListeners in background service workers for chrome extensions on suspend?

I'm adding listeners, e.g. chrome.tabs.onRemoved.addListener, in my chrome extension background service worker. I'm reading here: https://developer.chrome.com/docs/extensions/mv3/service_workers/#unloading that

Service workers unload on their own after a few seconds of inactivity

Does this mean I do not have to call removeListener logic to remove my listeners when the worker is suspended? i.e. chrome.tabs.onRemoved.removeListener on browser.runtime.onSuspend

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

No.

When you register a listener Chrome remembers internally that your extension's background script wants to run when this event occurs in the future so Chrome will wake your background script. If you remove the listener, Chrome won't wake your background script for this event.

P.S. The misguiding article on service workers can be replaced by the following sentence: the MV3 background script is essentially identical to an MV2 background script with "persistent": false except for the lack of stuff specific to normal tabs/windows such as DOM, XMLHttpRequest, etc.

about 4 years ago · Juan Pablo Isaza Relatório
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