dom / latest / serviceworkerregistration / periodicsync.html /

ServiceWorkerRegistration.periodicSync

The periodicSync read-only property of the ServiceWorkerRegistration interface returns a reference to the PeriodicSyncManager interface, which allows for registering of tasks to run at specific intervals.

Value

Examples

You can access the property from either your main script or the registered service worker.

Here is an example from the main script:

// reference registration
const registration = await navigator.serviceWorker.ready;

// feature detection
if ('periodicSync' in registration) {

  // Background Periodic Sync functionality
  const periodicSync = registration.periodicSync;

}

From the service worker:

// service worker script

const periodicSync = self.registration.periodicSync;

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
periodicSync
80
80
No
No
67
No
80
80
No
57
No
13.0

See also

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/periodicSync