File tree Expand file tree Collapse file tree 3 files changed +8
-9
lines changed Expand file tree Collapse file tree 3 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ const NOT_SUPPORTED_ERROR$ = throwError(
22
22
( ) => new Error ( 'Notification API is not supported in your browser' ) ,
23
23
) ;
24
24
25
+ const mapToVoid = map ( ( ) => undefined ) ;
26
+
25
27
@Injectable ( {
26
28
providedIn : 'root' ,
27
29
} )
@@ -86,17 +88,15 @@ export class NotificationService {
86
88
targetNotification : Notification ,
87
89
eventName : E ,
88
90
) : Observable < { action : string } | void > {
89
- const mapToVoid = map ( ( ) => undefined ) ;
91
+ const isTargetNotification = ( { timestamp} : { timestamp ?: number } ) =>
92
+ timestamp === targetNotification . timestamp ;
90
93
91
94
return this . swRegistration$ . pipe (
92
95
switchMap ( swRegistration => {
93
96
if ( ! swRegistration ) {
94
97
return fromEvent ( targetNotification , eventName ) . pipe ( mapToVoid ) ;
95
98
}
96
99
97
- const isTargetNotification = ( notification : { timestamp ?: number } ) =>
98
- notification . timestamp === targetNotification . timestamp ;
99
-
100
100
switch ( eventName ) {
101
101
case 'click' :
102
102
return this . notificationSwClicks$ . pipe (
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ export const NOTIFICATION_SW_CLICKS = new InjectionToken(
8
8
factory : ( ) => {
9
9
const swPush = inject ( SwPush , InjectFlags . Optional ) ;
10
10
11
- return swPush && swPush . isEnabled ? swPush . notificationClicks : NEVER ;
11
+ return swPush ? .isEnabled ? swPush . notificationClicks : NEVER ;
12
12
} ,
13
13
} ,
14
14
) ;
Original file line number Diff line number Diff line change @@ -23,8 +23,8 @@ export const NOTIFICATION_SW_CLOSES = new InjectionToken(
23
23
* return swPush && swPush.isEnabled ? swPush.notificationCloses : NEVER;
24
24
* ```
25
25
*/
26
- factory : ( ) : Observable < Notification > => {
27
- return combineLatest ( [
26
+ factory : ( ) : Observable < Notification > =>
27
+ combineLatest ( [
28
28
from ( inject ( SERVICE_WORKER ) . getRegistration ( ) ) ,
29
29
inject ( ANIMATION_FRAME ) ,
30
30
] ) . pipe (
@@ -37,7 +37,6 @@ export const NOTIFICATION_SW_CLOSES = new InjectionToken(
37
37
) ,
38
38
zoneOptimized ( inject ( NgZone ) ) ,
39
39
share ( ) ,
40
- ) ;
41
- } ,
40
+ ) ,
42
41
} ,
43
42
) ;
You can’t perform that action at this time.
0 commit comments