I am trying to create a feed reader that checks for an updated version of the feed every hour or so.
My problem is that the event page seems to turn inactive after
Using setInterval
to periodically run some code works fine on background pages, but not on event pages, because the event page goes inactive when the page is idle for a long while.
The correct way to schedule a periodic task on event pages is to use the chrome.alarms API:
chrome.alarms.onAlarm.addListener(function(alarm) {
if (alarm.name == 'name-of-alarm') {
// Do something...
testFunc();
}
});
// Create the alarm:
chrome.alarms.create('name-of-alarm', {
periodInMinutes: 60
});