W3cubDocs

/Web APIs

ServiceWorkerGlobalScope.onsync

The ServiceWorkerGlobalScope.onsync event of the ServiceWorkerGlobalScope interface is fired whenever a SyncEvent event occurs. This is triggered when a call to SyncManager.register is made from a service worker client page. The attempt to sync is made either immediately if the network is available or as soon as the network becomes available.

Syntax

ServiceWorkerGlobalScope.onsync = function(SyncEvent) { ... }
self.addEventListener('sync', function(SyncEvent) { ... })

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
onsync
49
79
44
Extended Support Releases (ESR) before Firefox 78 ESR do not support service workers and the Push API.
No
24
No
49
49
44
24
No
5.0

© 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/ServiceWorkerGlobalScope/onsync