July 2018
Intermediate to advanced
354 pages
8h 51m
English
Service worker background sync is a little complicated. It requires that you wrap all network-related activities you want to include in your sync logic in tags. This means in many cases that you must modify or completely rewrite your caching logic.
Plus, most browsers do not have support for this feature yet. We are on the verge of ubiquitous support, but that has limited this important feature's appeal.
However, Workbox includes a plugin module to make background sync a breeze. Just like the Expiration plugin, you add the Background Sync plugin to a strategy's list:
workbox.routing.registerRoute( new RegExp('/event/'), workbox.strategies.cacheFirst({ cacheName: 'events', plugins: [ new workbox.expiration.Plugin({ ...Read now
Unlock full access