Help Angular by taking a 1 minute survey!Go to surveyHome

ServiceWorkerModule

      
      class ServiceWorkerModule {
  static register(script: string, opts: { scope?: string; enabled?: boolean; } = {}): ModuleWithProviders<ServiceWorkerModule>
}
    

Static methods

Register the given Angular Service Worker script.

static register(script: string, opts: { scope?: string; enabled?: boolean; } = {}): ModuleWithProviders<ServiceWorkerModule>
      
      static register(script: string, opts: { scope?: string; enabled?: boolean; } = {}): ModuleWithProviders<ServiceWorkerModule>
    
Parameters
script string
opts object

Optional. Default is {}.

Returns

ModuleWithProviders<ServiceWorkerModule>

If enabled is set to false in the given options, the module will behave as if service workers are not supported by the browser, and the service worker will not be registered.

Providers

Provider
      
      SwPush
    
      
      SwUpdate