WebpushNotification interface

Represents the WebPush-specific notification options that can be included in WebpushConfig. This supports most of the standard options as defined in the Web Notification specification.

Signature:

export interface WebpushNotification 

Properties

Property Type Description
actions Array<{ action: string; icon?: string; title: string; }> An array of notification actions representing the actions available to the user when the notification is presented.
badge string URL of the image used to represent the notification when there is not enough space to display the notification itself.
body string Body text of the notification.
data any Arbitrary data that you want associated with the notification. This can be of any data type.
dir 'auto' | 'ltr' | 'rtl' The direction in which to display the notification. Must be one of auto, ltr or rtl.
icon string URL to the notification icon.
image string URL of an image to be displayed in the notification.
lang string The notification's language as a BCP 47 language tag.
renotify boolean A boolean specifying whether the user should be notified after a new notification replaces an old one. Defaults to false.
requireInteraction boolean Indicates that a notification should remain active until the user clicks or dismisses it, rather than closing automatically. Defaults to false.
silent boolean A boolean specifying whether the notification should be silent. Defaults to false.
tag string An identifying tag for the notification.
timestamp number Timestamp of the notification. Refer to https://developer.mozilla.org/en-US/docs/Web/API/notification/timestamp for details.
title string Title text of the notification.
vibrate number | number[] A vibration pattern for the device's vibration hardware to emit when the notification fires.

WebpushNotification.actions

An array of notification actions representing the actions available to the user when the notification is presented.

Signature:

actions?: Array<{
        action: string;
        icon?: string;
        title: string;
    }>;

WebpushNotification.badge

URL of the image used to represent the notification when there is not enough space to display the notification itself.

Signature:

badge?: string;

WebpushNotification.body

Body text of the notification.

Signature:

body?: string;

WebpushNotification.data

Arbitrary data that you want associated with the notification. This can be of any data type.

Signature:

data?: any;

WebpushNotification.dir

The direction in which to display the notification. Must be one of auto, ltr or rtl.

Signature:

dir?: 'auto' | 'ltr' | 'rtl';

WebpushNotification.icon

URL to the notification icon.

Signature:

icon?: string;

WebpushNotification.image

URL of an image to be displayed in the notification.

Signature:

image?: string;

WebpushNotification.lang

The notification's language as a BCP 47 language tag.

Signature:

lang?: string;

WebpushNotification.renotify

A boolean specifying whether the user should be notified after a new notification replaces an old one. Defaults to false.

Signature:

renotify?: boolean;

WebpushNotification.requireInteraction

Indicates that a notification should remain active until the user clicks or dismisses it, rather than closing automatically. Defaults to false.

Signature:

requireInteraction?: boolean;

WebpushNotification.silent

A boolean specifying whether the notification should be silent. Defaults to false.

Signature:

silent?: boolean;

WebpushNotification.tag

An identifying tag for the notification.

Signature:

tag?: string;

WebpushNotification.timestamp

Timestamp of the notification. Refer to https://developer.mozilla.org/en-US/docs/Web/API/notification/timestamp for details.

Signature:

timestamp?: number;

WebpushNotification.title

Title text of the notification.

Signature:

title?: string;

WebpushNotification.vibrate

A vibration pattern for the device's vibration hardware to emit when the notification fires.

Signature:

vibrate?: number | number[];