Registering a service worker is the first step towards enabling the following progressive web app features:
- Push notifications
- Add to homescreen
See Service Workers: an Introduction to learn more.
Registering a service worker involves only a few lines of code, but the only reason you'd use a service worker is to implement one of the progressive web app features outlined above. Implementing those features requires more work.
For more help on caching files for offline use, see the "How to pass the audit" section of the following Lighthouse doc: URL responds with a 200 when offline.
For enabling push notifications or "add to homescreen", complete the following step-by-step tutorials and then use what you learn to implement the features in your own app:
Checks if the Chrome Debugger returns a service worker version.