-
Notifications
You must be signed in to change notification settings - Fork 26.6k
Closed as not planned
Labels
area: service-workerIssues related to the @angular/service-worker packageIssues related to the @angular/service-worker package
Milestone
Description
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 existednotificationclick
event)
this.scope.addEventListener('notificationclick', (event) => this.onClick(event!)); - Add
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
this.notificationClicks = this.sw.eventsOfType('NOTIFICATION_CLICK').pipe(map((message: any) => message.data));
Alternatives considered
-
waterplea, vladimirpotekhin and splincode
Metadata
Metadata
Assignees
Labels
area: service-workerIssues related to the @angular/service-worker packageIssues related to the @angular/service-worker package