Skip to content

Commit 29e892a

Browse files
thePunderWomanAndrewKushnir
authored andcommitted
Revert "refactor(service-worker): make SwPush and SwUpdate tree-shakable (angular#61670)" (angular#61923)
This reverts commit f8c1b6e. PR Close angular#61923
1 parent 6097184 commit 29e892a

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

packages/service-worker/src/module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99
import {ModuleWithProviders, NgModule} from '@angular/core';
1010

1111
import {provideServiceWorker, SwRegistrationOptions} from './provider';
12+
import {SwPush} from './push';
13+
import {SwUpdate} from './update';
1214

1315
/**
1416
* @publicApi
1517
*/
16-
@NgModule()
18+
@NgModule({providers: [SwPush, SwUpdate]})
1719
export class ServiceWorkerModule {
1820
/**
1921
* Register the given Angular Service Worker script.

packages/service-worker/src/provider.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import {
2121
import type {Observable} from 'rxjs';
2222

2323
import {NgswCommChannel} from './low_level';
24+
import {SwPush} from './push';
25+
import {SwUpdate} from './update';
2426
import {RuntimeErrorCode} from './errors';
2527

2628
export const SCRIPT = new InjectionToken<string>(ngDevMode ? 'NGSW_REGISTER_SCRIPT' : '');
@@ -211,6 +213,8 @@ export function provideServiceWorker(
211213
options: SwRegistrationOptions = {},
212214
): EnvironmentProviders {
213215
return makeEnvironmentProviders([
216+
SwPush,
217+
SwUpdate,
214218
{provide: SCRIPT, useValue: script},
215219
{provide: SwRegistrationOptions, useValue: options},
216220
{

packages/service-worker/src/push.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ import {ERR_SW_NOT_SUPPORTED, NgswCommChannel, PushEvent} from './low_level';
9292
*
9393
* @publicApi
9494
*/
95-
@Injectable({providedIn: 'root'})
95+
@Injectable()
9696
export class SwPush {
9797
/**
9898
* Emits the payloads of the received push notification messages.

packages/service-worker/src/update.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
*
2626
* @publicApi
2727
*/
28-
@Injectable({providedIn: 'root'})
28+
@Injectable()
2929
export class SwUpdate {
3030
/**
3131
* Emits a `VersionDetectedEvent` event whenever a new version is detected on the server.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy