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(
2222 ( ) => new Error ( 'Notification API is not supported in your browser' ) ,
2323) ;
2424
25+ const mapToVoid = map ( ( ) => undefined ) ;
26+
2527@Injectable ( {
2628 providedIn : 'root' ,
2729} )
@@ -86,17 +88,15 @@ export class NotificationService {
8688 targetNotification : Notification ,
8789 eventName : E ,
8890 ) : Observable < { action : string } | void > {
89- const mapToVoid = map ( ( ) => undefined ) ;
91+ const isTargetNotification = ( { timestamp} : { timestamp ?: number } ) =>
92+ timestamp === targetNotification . timestamp ;
9093
9194 return this . swRegistration$ . pipe (
9295 switchMap ( swRegistration => {
9396 if ( ! swRegistration ) {
9497 return fromEvent ( targetNotification , eventName ) . pipe ( mapToVoid ) ;
9598 }
9699
97- const isTargetNotification = ( notification : { timestamp ?: number } ) =>
98- notification . timestamp === targetNotification . timestamp ;
99-
100100 switch ( eventName ) {
101101 case 'click' :
102102 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(
88 factory : ( ) => {
99 const swPush = inject ( SwPush , InjectFlags . Optional ) ;
1010
11- return swPush && swPush . isEnabled ? swPush . notificationClicks : NEVER ;
11+ return swPush ? .isEnabled ? swPush . notificationClicks : NEVER ;
1212 } ,
1313 } ,
1414) ;
Original file line number Diff line number Diff line change @@ -23,8 +23,8 @@ export const NOTIFICATION_SW_CLOSES = new InjectionToken(
2323 * return swPush && swPush.isEnabled ? swPush.notificationCloses : NEVER;
2424 * ```
2525 */
26- factory : ( ) : Observable < Notification > => {
27- return combineLatest ( [
26+ factory : ( ) : Observable < Notification > =>
27+ combineLatest ( [
2828 from ( inject ( SERVICE_WORKER ) . getRegistration ( ) ) ,
2929 inject ( ANIMATION_FRAME ) ,
3030 ] ) . pipe (
@@ -37,7 +37,6 @@ export const NOTIFICATION_SW_CLOSES = new InjectionToken(
3737 ) ,
3838 zoneOptimized ( inject ( NgZone ) ) ,
3939 share ( ) ,
40- ) ;
41- } ,
40+ ) ,
4241 } ,
4342) ;
You can’t perform that action at this time.
0 commit comments