{ "id": "api/service-worker", "title": "@angular/service-worker", "contents": "\n\n
\n
\n
\n \n API\n
\n \n
\n \n
\n

@angular/service-workerlink

\n \n \n \n \n
\n\n \n\n
\n

Implements a service worker for Angular apps.\nAdding a service worker to an Angular app is one of the steps for turning it into a Progressive Web App (also known as a PWA).

\n\n

At its simplest, a service worker is a script that runs in the web browser and manages caching for an application.\nService workers function as a network proxy. They intercept all outgoing HTTP requests made by the application and can choose how to respond to them.

\n

To set up the Angular service worker in your project, use the CLI add command.

\n\nng add @angular/pwa\n\n

The command configures your app to use service workers by adding the service-worker package\nand generating the necessary support files.

\n

For more usage information, see the Service Workers guide.

\n\n\n \n\n\n \n

Entry pointslink

\n \n \n \n
\n

Primarylink

\n \n \n \n \n \n \n \n
@angular/service-worker\n \n

Implements a service worker for Angular apps.\nAdding a service worker to an Angular app is one of the steps for turning it into a Progressive Web App (also known as a PWA).

\n\n
\n
\n \n\n \n \n \n\n \n\n

Primary entry point exportslink

\n \n \n \n \n \n
\n

NgModuleslink

\n \n \n \n \n \n \n \n
ServiceWorkerModule\n \n \n
\n
\n \n\n \n \n \n
\n

Classeslink

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
SwPush\n \n

Subscribe and listen to\nWeb Push\nNotifications through\nAngular Service Worker.

\n\n
SwRegistrationOptions\n \n

Token that can be used to provide options for ServiceWorkerModule outside of\nServiceWorkerModule.register().

\n\n
SwUpdate\n \n

Subscribe to update notifications from the Service Worker, trigger update\nchecks, and forcibly activate updates.

\n\n
\n
\n \n\n \n \n \n\n \n \n \n\n \n \n \n
\n

Structureslink

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
UnrecoverableStateEvent\n \n

An event emitted when the version of the app used by the service worker to serve this client is\nin a broken state that cannot be recovered from and a full page reload is required.

\n\n
UpdateActivatedEvent\n \n

An event emitted when a new version of the app has been downloaded and activated.

\n\n
UpdateAvailableEvent\n \n

An event emitted when a new version of the app is available.

\n\n
\n
\n \n\n \n \n \n\n \n \n \n\n \n \n \n\n
\n
\n\n\n" }