• Back to Glue42 Core Docs
Glue42 core documentation

Reference Documentation

  • Back to Glue42 Core Docs
Press/
  • Glue42 Web
  • AppManager
  • Channels
  • Intents
  • Interop
  • Layouts
  • Notifications
  • Shared Contexts
  • Themes
  • Windows
  • Workspaces

Notifications

2.20.0

The 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

  • clear
  • clearAll
  • click
  • getPermission
  • list
  • onClosed
  • onRaised
  • raise
  • requestPermission

clearmethod

Signature

(id: string) => Promise<void>

Description

Clears a specified notification.

Parameters

Name Type Required Description
id string

The id of the notification to be removed.

clearAllmethod

Signature

() => Promise<void>

Description

Removes all known notifications from the system.

clickmethod

Signature

(id: string, action?: string) => Promise<void>

Description

Issues a programmatic click on a notification.

Parameters

Name Type Required Description
id string

The id of the notification to click on.

action string

getPermissionmethod

Signature

() => Promise<"granted" | "denied" | "default">

Description

Glue42 Core and Core Plus only. Retrieves the state of the native browser notification permission for the platform.

listmethod

Signature

() => Promise<NotificationData[]>

Description

Returns a list of all known notifications.

onClosedmethod

Signature

(callback: (notification: { id: string; }) => void) => UnsubscribeFunction

Description

Notifies the user when a notification was removed via the Notifications API.

Parameters

Name Type Required Description
callback (notification: { id: string; }) => void

A function which will be called when a notification is removed.

onRaisedmethod

Signature

(callback: (notification: NotificationData) => void) => UnsubscribeFunction

Description

Notifies the user of any new raised notifications via the Notifications API.

Parameters

Name Type Required Description
callback (notification: NotificationData) => void

A function which will be called when a new notification is raised.

raisemethod

Signature

(notification: RaiseOptions) => Promise<Notification>

Description

Raises a new notification

Parameters

Name Type Required Description
notification RaiseOptions

notification options

requestPermissionmethod

Signature

() => Promise<boolean>

Description

Glue42 Core and Core Plus only. Triggers the native browser permission dialog. Must only be called from within a platform.

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
id string
onclick () => any
onshow () => any

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

NotificationDataobject

Properties

Property Type Default Required Description
actions NotificationAction[]

List of action attached to the notification. Those will appear as buttons in the notification UI

clickInterop InteropActionSettings

set to make the notification click invoke an interop method with specific arguments

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.

id string
severity "Low" | "Medium" | "High" | "Critical" | "None"

Severity of the alert

showInPanel boolean

Indicates whether the notification should appear in notification panels. Defaults to true

showToast boolean

Indicates whether a native toast will be shown or not. Defaults to true

title string

the title of the notification

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[]

List of action attached to the notification. Those will appear as buttons in the notification UI

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
severity "Low" | "Medium" | "High" | "Critical" | "None"

Severity of the alert

showInPanel boolean

Indicates whether the notification should appear in notification panels. Defaults to true

showToast boolean

Indicates whether a native toast will be shown or not. Defaults to true

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
  • © 2023 Glue42
  • Home
  • Privacy policy
  • Contact Sales
  • Glue42.com
  • Tick42.com
  • Overview
  • API
  • ActionClickHandler
  • InteropActionSettings
  • Notification
  • NotificationAction
  • NotificationData
  • NotificationDefinition
  • RaiseOptions
  • Settings
  • NotificationClickHandler
Navigate
Go