Handling browser desktop notification API.

Constructors

Properties

showNotificationRequest: BehaviorSubject<boolean>

Whether to show user that they have not allowed notifications yet.

Only true when user has not denied or granted notification permission.

supported: boolean

Flag for whether notifications are supported on this device.

window: Window

Accessors

Methods

  • Requests permission from the user to display desktop notifications.

    Returns Observable<NotificationPermission>

    An observable that resolves to the notification permission status.

  • Displays a desktop notification with the provided options.

    Parameters

    • title: string

      The title of the notification.

    • Optionaloptions: NotificationOptions

      Configuration options for the notification (optional).

    • OptionalonClick: (() => void)

      Callback function to execute when the notification is clicked (optional).

        • (): void
        • Returns void

    Returns null | Notification