Notifications
2.7.1The Notifications API provides a way to display native notifications with actions and to handle notification and action clicks.
Glue42 Core supports all available Notification
settings as defined in the DOM Notifications API.
The Glue42 Core Notifications API extends the DOM Notifications API with the option to handle notification and action clicks using Interop methods.
The Notifications API is accessible through the glue.notifications
object.
APIobject
Methods
getPermissionmethod
Signature
() => Promise<"granted" | "denied" | "default">
raisemethod
Signature
(notification: RaiseOptions) => Promise<Notification>
Description
Raises a new notification
Parameters
Name | Type | Required | Description |
---|---|---|---|
notification | RaiseOptions | notification options |
requestPermissionmethod
Signature
() => Promise<boolean>
ActionClickHandlerobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
action | string | |||
handler | NotificationClickHandler |
InteropActionSettingsobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
arguments | any | |||
method | string | |||
target | "all" | "best" |
Notificationobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
badge | string | |||
body | string | |||
data | any | |||
dir | "auto" | "ltr" | "rtl" | |||
icon | string | |||
image | string | |||
lang | string | |||
onclick | () => any | |||
onshow | () => any | |||
renotify | boolean | |||
requireInteraction | boolean | |||
silent | boolean | |||
tag | string | |||
timestamp | number | |||
vibrate | number[] |
NotificationActionobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
action | string | |||
icon | string | |||
interop | InteropActionSettings | set to make the action invoke an interop method with specific arguments |
||
title | string |
NotificationDefinitionobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
badge | string | |||
body | string | |||
data | any | |||
dir | "auto" | "ltr" | "rtl" | |||
icon | string | |||
image | string | |||
lang | string | |||
renotify | boolean | |||
requireInteraction | boolean | |||
silent | boolean | |||
tag | string | |||
timestamp | number | |||
vibrate | number[] |
RaiseOptionsobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
actions | NotificationAction[] | |||
badge | string | |||
body | string | |||
clickInterop | InteropActionSettings | set to make the notification click invoke an interop method with specific arguments |
||
data | any | |||
dir | "auto" | "ltr" | "rtl" | |||
focusPlatformOnDefaultClick | boolean | Glue42 Core Only. If set to true, the platform app will be focused when the user clicks on the notification. Defaults to false. |
||
icon | string | |||
image | string | |||
lang | string | |||
renotify | boolean | |||
requireInteraction | boolean | |||
silent | boolean | |||
tag | string | |||
timestamp | number | |||
title | string | the title of the notification |
||
vibrate | number[] |
Settingsobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
actionClicks | ActionClickHandler[] | |||
defaultClick | NotificationClickHandler |
NotificationClickHandlerfunction
Signature
(glue: API, notificationDefinition: NotificationDefinition) => void
Parameters
Name | Type | Required | Description |
---|---|---|---|
glue | API | ||
notificationDefinition | NotificationDefinition |