I am making a countdown timer chrome extension using mv3. The problem is if I use the setInterval
or setTimeout
method in a service worker, chrome suspends the service worker after 20s or above.
I've tried to use chrome.storage.local.onChanged
api to add a listener and inside that listener I've used setTimeout
method and updated the countdown timer after 1s, but still chrome suspends the servicer worker.
I don't want to use timers in the content scripts because then again I've to keep syncing the timers and if there are 100 tabs opened this will be not efficient.
If anyone have simple and efficient solution, kindly help me