ServiceWorkerGlobalScope: sync event

Draft: This page is not complete.

The sync event of the ServiceWorkerGlobalScope interface is fired when the page (or worker) that registered the event with the SyncManager is running and as soon as network connectivity is available.

Bubbles No
Cancelable No
Interface SyncEvent
Event handler property ServiceWorkerGlobalScope.onsync


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

self.addEventListener('sync', event => {
  if (event.tag == 'sync-messages') {

You can also set up the event handler using the ServiceWorkerGlobalScope.onsync property:

self.onsync = event => {


Web Background Synchronization (Background Sync)
# sync-event

Browser compatibility

BCD tables only load in the browser

See also