Connect the application to its service worker
Track the worker from registration through an accepted update.
The linked recipe generates the worker, reports registration, update and failure states, and applies an accepted waiting update.
Table of contents
Main APIs
- SwRuntimeManager
- Exposes installing, registration, waiting and updateAvailable state and manages service worker updates.
- registerSw
- Registers a service worker file for the application.
- SwRuntimeEnvironment
- Type. Environment objects used by the service worker runtime.
Practice
Before registration
Serve the application and generated worker from localhost or another origin where service workers are available. SwRuntimeManager registers the swUrl served by that application.