ServiceWorkerModule

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

静态方法

Register the given Angular Service Worker script.

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

参数

script

Type: string.

opts

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

可选. 默认值是 {}.

返回值

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.

注解

@NgModule({ providers: [SwPush, SwUpdate] })