Skip to content

Add notificationCloses to SwPush #52244

Closed as not planned
Closed as not planned

Description

@nsbarsukov

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

-

Activity

  1. nsbarsukov commented on Oct 17, 2023

    @nsbarsukov
    ContributorAuthor

    I can contribute PR by yourself if you don't mind

  2. added this to the needsTriage milestone on Oct 17, 2023
  3. JeanMeche commented on Aug 27, 2025

    @JeanMeche
    Member

    Per #63364, we won't be addressing this issue.

    The message is also visible here: https://angular.dev/ecosystem/service-workers

  4. angular-automatic-lock-bot commented on Sep 27, 2025

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  5. locked and limited conversation to collaborators on Sep 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: service-workerIssues related to the @angular/service-worker package

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions