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
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 | |
onperiodicsync |
80 |
80 |
No |
No |
67 |
No |
No |
80 |
No |
57 |
No |
13.0 |
See also
- Richer offline experiences with the Periodic Background Sync API
- A Periodic Background Sync demo app
© 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/onperiodicsync