ServiceWorkerGlobalScope.onperiodicsync

Draft
This page is not complete.

The onperiodicsync property of the ServiceWorkerGlobalScope interface is an event handler fired at timed intervals, specified when registering a PeriodicSyncManager.

Syntax

ServiceWorkerGlobalScope.onperiodicsync = function(event) { ... };

Examples

The following example shows how to respond to a periodic sync event in the service worker.

self.addEventListener('periodicsync', event => {
  if (event.tag == 'get-latest-news') {
    event.waitUntil(fetchAndCacheLatestNews());
  }
});

Specifications

Specification Status Comment
Web Periodic Background Synchronization
The definition of 'onperiodicsync' in that specification.
Working Draft Initial definition.

Browser compatibility

No compatibility data found. Please contribute data for "api.ServiceWorkerGlobalScope.periodicsync" (depth: 1) to the MDN compatibility data repository.

See also