Which @angular/* package(s) are relevant/related to the feature request?
service-worker
Description
Angular official documentation page says:
When using the Angular service worker, push notification interactions are handled using the SwPush service. To learn more about the browser APIs involved see Push API and Using the Notifications API.
The SwPush service contains notificationClicks property to handle serviceWorkerGlobalScope.notificationclick.
But serviceWorkerGlobalScope also emits notificationclose event.
Proposed solution
Add notificationCloses property to SwPush service.
Proposed steps:
- Add
this.scope.addEventListener('notificationclose', (event) => this.onClose(event!)); (similar to already existed notificationclick event)
|
this.scope.addEventListener('notificationclick', (event) => this.onClick(event!)); |
- Add
this.notificationCloses = this.sw.eventsOfType('NOTIFICATION_CLOSE') (similar to already existed NOTIFICATION_CLICK)
|
this.notificationClicks = |
|
this.sw.eventsOfType('NOTIFICATION_CLICK').pipe(map((message: any) => message.data)); |
Alternatives considered
-
Which @angular/* package(s) are relevant/related to the feature request?
service-worker
Description
Angular official documentation page says:
The SwPush service contains notificationClicks property to handle serviceWorkerGlobalScope.notificationclick.
But
serviceWorkerGlobalScopealso emits notificationclose event.Proposed solution
Add
notificationClosesproperty toSwPushservice.Proposed steps:
this.scope.addEventListener('notificationclose', (event) => this.onClose(event!));(similar to already existednotificationclickevent)angular/packages/service-worker/worker/src/driver.ts
Line 172 in 634c529
this.notificationCloses = this.sw.eventsOfType('NOTIFICATION_CLOSE')(similar to already existedNOTIFICATION_CLICK)angular/packages/service-worker/src/push.ts
Lines 148 to 149 in 634c529
Alternatives considered
-