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 SynchronizationThe definition of 'onperiodicsync' in that specification. | Working Draft | Initial definition. |
Browser compatibility
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
No compatibility data found. Please contribute data for "api.ServiceWorkerGlobalScope.periodicsync" (depth: 1) to the MDN compatibility data repository.
See also
- Richer offline experiences with the Periodic Background Sync API
- A Periodic Background Sync demo app
ServiceWorkerGlobalScope.onperiodicsync by Mozilla Contributors is licensed under CC-BY-SA 2.5.