service worker works only when DevTools (Console) is open

Viewed 271

I'm building chrome extension, and in background script I use:

chrome.alarms.create({periodInMinutes: 1})

chrome.alarms.onAlarm.addListener(() => {
  doSomeStuff();
});

I do it few times, and in the last call, I do clearAll alarms.

The problem which I encounter in this situation is: My app works perfectly when Console is open. But if I close my console in Chrome, my app stops working.

My opinion is that when I open Console to inspect service worker service worker is awake, but when I close it my service worker goes into idle (sleep) mode.

How to solve it?

0 Answers
Related