This is the archived documentation for Angular v6. Please visit angular.io to see documentation for the current version of Angular.

ServiceWorkerModule

      
      class ServiceWorkerModule {
  static register(script: string, opts: {...}): ModuleWithProviders
}
    

Static methods

Register the given Angular Service Worker script.

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

Parameters

script

Type: string.

opts

Type: { scope?: string; enabled?: boolean; }.

Optional. Default is {}.

Returns

ModuleWithProviders

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