mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
This reverts commit f8c1b6e779.
PR Close #61923
This commit is contained in:
committed by
Andrew Kushnir
parent
6097184711
commit
29e892a35e
@@ -9,11 +9,13 @@
|
||||
import {ModuleWithProviders, NgModule} from '@angular/core';
|
||||
|
||||
import {provideServiceWorker, SwRegistrationOptions} from './provider';
|
||||
import {SwPush} from './push';
|
||||
import {SwUpdate} from './update';
|
||||
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
@NgModule()
|
||||
@NgModule({providers: [SwPush, SwUpdate]})
|
||||
export class ServiceWorkerModule {
|
||||
/**
|
||||
* Register the given Angular Service Worker script.
|
||||
|
||||
@@ -21,6 +21,8 @@ import {
|
||||
import type {Observable} from 'rxjs';
|
||||
|
||||
import {NgswCommChannel} from './low_level';
|
||||
import {SwPush} from './push';
|
||||
import {SwUpdate} from './update';
|
||||
import {RuntimeErrorCode} from './errors';
|
||||
|
||||
export const SCRIPT = new InjectionToken<string>(ngDevMode ? 'NGSW_REGISTER_SCRIPT' : '');
|
||||
@@ -211,6 +213,8 @@ export function provideServiceWorker(
|
||||
options: SwRegistrationOptions = {},
|
||||
): EnvironmentProviders {
|
||||
return makeEnvironmentProviders([
|
||||
SwPush,
|
||||
SwUpdate,
|
||||
{provide: SCRIPT, useValue: script},
|
||||
{provide: SwRegistrationOptions, useValue: options},
|
||||
{
|
||||
|
||||
@@ -92,7 +92,7 @@ import {ERR_SW_NOT_SUPPORTED, NgswCommChannel, PushEvent} from './low_level';
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
@Injectable({providedIn: 'root'})
|
||||
@Injectable()
|
||||
export class SwPush {
|
||||
/**
|
||||
* Emits the payloads of the received push notification messages.
|
||||
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
@Injectable({providedIn: 'root'})
|
||||
@Injectable()
|
||||
export class SwUpdate {
|
||||
/**
|
||||
* Emits a `VersionDetectedEvent` event whenever a new version is detected on the server.
|
||||
|
||||
Reference in New Issue
Block a user