hub.eb?material_id=442&track_id=438

The Verj.io Service Worker


A service worker acts a proxy between the user's device and the web server. It maintains offline cache of all the resources requested by the PWA. Verj.io includes a service worker that can be used when developing a PWA.

When files within a Server Resources folder are requested, the service worker will serve these directly from its cache (a strategy known as cache-first). This results in short load times, reduced network usage and ensures that the resources are available offline.

We recommend adding static resources (e.g. images, client-side JavaScript libraries and stylesheets) to a Server Resources folder to take advantage of cache-first serving. It is the designer's discretion whether other resources are included.

The service worker will attempt to serve the online version for all other requests, falling back to a cached version if it is unavailable (a strategy known as online-first). This ensures that the most up-to-date version of those resources are served whenever possible, at the expense of slightly longer load times and a higher network usage.

If the service worker cannot contact the server and the requested form is not cached the Error Page is displayed. If no Error Page is configured, a generic error page is displayed.

Current Module

Related