0

I have an existing Auto-reload Chrome extension using manifest version 2. It is achieved by using a background page with persistent: true so a setInterval can run indefinitely. Chrome is phasing out MV2 soon so I want to upgrade it realized it's difficult with service worker replacement.

  • The Service Worker would become inactive after about 30 seconds so setTimeout or setInterval is out of question.

  • chrome.alarms only run once every minute and with inaccuracies. My extension provides options under a minute like 10s or 30s.

What is a solution for a general frequent timer like my case?

Luke Vo
  • 14,925
  • 19
  • 92
  • 153
  • 1
    There's no solution. The workaround is to [keep the worker running](https://stackoverflow.com/questions/66618136/persistent-service-worker-in-chrome-extension/66618269). – wOxxOm Jan 12 '22 at 17:11
  • @wOxxOm Thanks, I found that article after the question as well. I am also trying my own approach similar to that but in my specific case I have access to `activeTab` and only need to keep it awake as long as the tab is still active. – Luke Vo Jan 12 '22 at 17:22

0 Answers0