Maxim Salnikov
@webmaxru
What's available in browser's Background Services
Developer Audience Lead at Microsoft
Service
worker
OS
Browser
Internet
App
Event
Event
Event
Event
Message
(Triggers)
const registration = await navigator.serviceWorker.ready;
if ('periodicSync' in registration) {
  registration.periodicSync.register('update-content', {
    
      // An interval of one day.
      minInterval: 24 * 60 * 60 * 1000
  })
}main.js
self.addEventListener('periodicsync', (event) => {
  if (event.tag === 'update-content') {
    
    // Think before you sync!
    event.waitUntil(updateContent());
  }
});service-worker.js
| Engagement Score | Periodic Sync Interval (hours) | 
|---|---|
| NONE | Never | 
| MINIMAL | 36 | 
| LOW | 24 | 
| MEDIUM | 24 | 
| HIGH | 12 | 
| MAX | 12 | 
const registration = await navigator.serviceWorker.ready;
if ('showTrigger' in Notification.prototype) {
      
  // In 5 seconds from now
  const triggerTime =  Date.now() + 5 * 1000
  registration.showNotification('Notification Trigger Demo', {
    body: `Scheduled for ${new Date( triggerTime ).toLocaleTimeString()}`,
    showTrigger: new TimestampTrigger( triggerTime )
  });
}main.js
Long answer
Short answer
* Progressive = "Progressive Enhancement"
Maxim Salnikov
@webmaxru