Summary A ServiceWorker onsync event that can be registered for from a main-frame document or service worker with a main-frame client. Once registered, the onsync event will fire when next online (even after the page or browser has closed). The event doesn’t finish until either five minutes have passed, the event completes without a waitUntil, or the waitUntil rejects/resolves. If the event fails, the browser will retry (exponential backoff) up to a total of five attempts.
Motivation Web Applications often run in environments with unreliable networks (e.g., mobile phones) and unknown lifetimes (the browser might be killed or the user might navigate away). This makes it difficult to synchronize client data from web apps (such as photo uploads, document changes, or composed emails) with servers. If the browser closes or the user navigates away before synchronization can complete, the app must wait until the user revisits the page to try again. This specification provides a new onsync service worker <https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#service-worker-concept> event which can fire in the background <https://wicg.github.io/BackgroundSync/spec/#in-the-background> so that synchronization attempts can continue despite adverse conditions when initially requested. This API is intended to reduce the time between content creation and content synchronization with the server. Bug https://bugzilla.mozilla.org/show_bug.cgi?id=1217544 <https://bugzilla.mozilla.org/show_bug.cgi?id=1217544> Link to standard https://wicg.github.io/BackgroundSync/spec/ <https://wicg.github.io/BackgroundSync/spec/> Platform coverage Desktop, Android, Firefox OS. State in other UAs Already implemented on Chrome, unclear on the others. Preference behind which this will be implemented dom.background.sync.enabled Cheers, / Fernando _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform