Notifications
5.19.0The Glue42 Notifications API extends the DOM Notifications API. It allows notification and action clicks to be handled using Interop methods.
The Notifications API is accessible through the glue.notifications
object.
APIobject
Description
Notifications API
Available since version Glue42 Enterprise 3.9Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
maxActions | number | The maximum number of actions supported by the UI toast. |
||
panel | NotificationPanelAPI | Controls the notification panel UI Available since version Glue42 3.12.1 |
Methods
configuremethod
Signature
(options: Configuration) => Promise<void>
Description
Configure global Glue42 Notifications settings
Parameters
Name | Type | Required | Description |
---|---|---|---|
options | Configuration |
getFiltermethod
Signature
() => Promise<NotificationFilter>
Description
Returns the current filter used to filter notifications
raisemethod
Signature
(notification: Glue42NotificationOptions) => Promise<Glue42Notification>
Description
Raises a new notification
Parameters
Name | Type | Required | Description |
---|---|---|---|
notification | Glue42NotificationOptions | notification options |
setFiltermethod
Signature
(filter: NotificationFilter) => Promise<NotificationFilter>
Description
Filters notifications
Parameters
Name | Type | Required | Description |
---|---|---|---|
filter | NotificationFilter |
ActionEventobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
action | string | |||
AT_TARGET | number | |||
bubbles | boolean | Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. |
||
BUBBLING_PHASE | number | |||
cancelable | boolean | Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. |
||
cancelBubble | boolean | |||
CAPTURING_PHASE | number | |||
composed | boolean | Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. |
||
currentTarget | EventTarget | Returns the object whose event listener's callback is currently being invoked. |
||
defaultPrevented | boolean | Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. |
||
eventPhase | number | Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. |
||
isTrusted | boolean | Returns true if event was dispatched by the user agent, and false otherwise. |
||
NONE | number | |||
returnValue | boolean | |||
srcElement | EventTarget | |||
target | EventTarget | Returns the object to which event is dispatched (its target). |
||
timeStamp | number | Returns the event's timestamp as the number of milliseconds measured relative to the time origin. |
||
type | string | Returns the type of event, e.g. "click", "hashchange", or "submit". |
Methods
composedPathmethod
Signature
() => EventTarget[]
Description
Returns the invocation target objects of event's path (objects on which listeners will be invoked), except for any nodes in shadow trees of which the shadow root's mode is "closed" that are not reachable from event's currentTarget.
initEventmethod
Signature
(type: string, bubbles?: boolean, cancelable?: boolean) => void
Parameters
Name | Type | Required | Description |
---|---|---|---|
type | string | ||
bubbles | boolean | ||
cancelable | boolean |
preventDefaultmethod
Signature
() => void
Description
If invoked when the cancelable attribute value is true, and while executing a listener for the event with passive set to false, signals to the operation that caused event to be dispatched that it needs to be canceled.
stopImmediatePropagationmethod
Signature
() => void
Description
Invoking this method prevents event from reaching any registered event listeners after the current one finishes running and, when dispatched in a tree, also prevents event from reaching any other objects.
stopPropagationmethod
Signature
() => void
Description
When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object.
Configurationobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
enable | boolean | If set to true will enable all types of notifications - both panel and toasts |
||
enableToasts | boolean | If set to true will enable toast notifications |
Glue42Notificationobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
actions | readonly NotificationAction[] | |||
badge | string | |||
body | string | |||
data | any | |||
dir | NotificationDirection | |||
icon | string | |||
image | string | |||
lang | string | |||
onaction | (this: Notification, ev: ActionEvent) => any | |||
onclick | (this: Notification, ev: Event) => any | |||
onclose | (this: Notification, ev: Event) => any | |||
onerror | (this: Notification, ev: Event) => any | |||
onshow | (this: Notification, ev: Event) => any | |||
renotify | boolean | |||
requireInteraction | boolean | |||
silent | boolean | |||
tag | string | |||
timestamp | number | |||
title | string | |||
vibrate | readonly number[] |
Methods
addEventListenermethod
Signature
<K>(type: K, listener: (this: Notification, ev: NotificationEventMap[K]) => any, options?: boolean | AddEventListenerOptions) => void
Parameters
Name | Type | Required | Description |
---|---|---|---|
type | K | ||
listener | (this: Notification, ev: NotificationEventMap[K]) => any | ||
options | boolean | AddEventListenerOptions |
closemethod
Signature
() => void
removeEventListenermethod
Signature
<K>(type: K, listener: (this: Notification, ev: NotificationEventMap[K]) => any, options?: boolean | EventListenerOptions) => void
Parameters
Name | Type | Required | Description |
---|---|---|---|
type | K | ||
listener | (this: Notification, ev: NotificationEventMap[K]) => any | ||
options | boolean | EventListenerOptions |
Glue42NotificationActionobject
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 |
Glue42NotificationOptionsobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
actions | Glue42NotificationAction[] | List of action attached to the notification. Those will appear as buttons in the notification UI |
||
badge | string | |||
body | string | |||
clickInterop | InteropActionSettings | Set this to make clicking on the notification invoking an interop method with specific arguments. You can also attach to onclick callback to the Notification object. |
||
data | any | |||
dir | NotificationDirection | |||
icon | string | |||
image | string | |||
lang | string | |||
panelExpiry | number | If set will remove the notification from the notification panel after the specified amount of seconds |
||
renotify | boolean | |||
requireInteraction | boolean | |||
severity | "Low" | "Medium" | "High" | "Critical" | "None" | Severity of the alert |
||
silent | boolean | |||
source | string | A way to override notification source |
||
tag | string | |||
timestamp | number | |||
title | string | The title of the notification |
||
toastExpiry | number | If set will hide the toast after the specified amount of seconds |
||
type | "Notification" | "Alert" | Type of the notification - Notification is some information that can be classified as important but not urgent. Alert is usually a special, urgent notification about the occurrence of a specific event. |
||
vibrate | VibratePattern |
InteropActionSettingsobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
arguments | any | |||
method | string | |||
target | "best" | "all" |
NotificationFilterobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
allowed | string[] | |||
blocked | string[] |
NotificationPanelAPIobject
Methods
hidemethod
Signature
() => Promise<void>
Description
Hides the notification panel
Available since version Glue42 3.12.1
isVisiblemethod
Signature
() => Promise<boolean>
Description
Checks if the notification panel is visible
Available since version Glue42 3.12.1
showmethod
Signature
() => Promise<void>
Description
Shows the notification panel
Available since version Glue42 3.12.1
togglemethod
Signature
() => Promise<void>
Description
Toggles visibility
Available since version Glue42 3.12.1