• Back to io.Connect Browser docs
io.Connect Browser Documentation

API Reference Documentation

  • Back to io.Connect Browser docs
Press/
  • io.Connect Browser
  • App Management
  • App Preferences
  • Channels
  • Intents
  • Interop
  • Layouts
  • Notifications
  • Search
  • Shared Contexts
  • Themes
  • Widget
  • Windows
  • Workspaces

Notifications

3.5.9

The Notifications API provides a way to display native notifications with actions and to handle notification and action clicks. io.Connect Browser supports all available Notification settings as defined in the DOM Notifications API.

The io.Connect Browser 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 io.notifications object.

APIobject

Methods

  • clear
  • clearAll
  • clearOld
  • click
  • configure
  • getConfiguration
  • getFilter
  • getPermission
  • list
  • onActiveCountChanged
  • onClosed
  • onConfigurationChanged
  • onRaised
  • onStateChanged
  • raise
  • requestPermission
  • setFilter
  • setState

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.

clearOldmethod

Signature

() => Promise<void>

Description

Clears all notifications that the user has already seen.

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

configuremethod

Signature

(options: Configuration) => Promise<void>

Description

Configures the Global notification settings.

Parameters

Name Type Required Description
options Configuration

configuration options

getConfigurationmethod

Signature

() => Promise<Configuration>

Description

Retrieves the current global notification settings.

getFiltermethod

Signature

() => Promise<NotificationFilter>

Description

Retrieves the current filter with apps allowed or not allowed to raise notifications.

getPermissionmethod

Signature

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

Description

io.Connect Browser 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.

onActiveCountChangedmethod

Signature

(callback: (info: { count: number; }) => void) => UnsubscribeFunction

Description

Notifies when the number of active notification is changed.

Parameters

Name Type Required Description
callback (info: { count: number; }) => void

Callback function for handling the event.

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.

onConfigurationChangedmethod

Signature

(callback: (configuration: Configuration) => void) => UnsubscribeFunction

Description

Notifies when the global notification settings are changed.

Parameters

Name Type Required Description
callback (configuration: Configuration) => void

Callback function for handling the event.

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.

onStateChangedmethod

Signature

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

Description

Notifies when the state of a notification is changed.

Parameters

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

Callback function for handling the event.

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

io.Connect Browser only. Triggers the native browser permission dialog. Must only be called from within a platform.

setFiltermethod

Signature

(filter: NotificationFilter) => Promise<NotificationFilter>

Description

Sets a filter with apps allowed or not allowed to raise notifications.

Parameters

Name Type Required Description
filter NotificationFilter

Filter with names of apps allowed or not allowed to raise notifications.

setStatemethod

Signature

(id: string, state: State) => Promise<void>

Description

Sets the state of a notification.

Parameters

Name Type Required Description
id string

ID of the notification to change.

state State

Value for the new notification state.

ActionClickHandlerobject

Properties

Property Type Default Required Description
action string
handler NotificationClickHandler

Configurationobject

Description

Global notification settings

Properties

Property Type Default Required Description
enable boolean

If true, will enable all notifications.

enableToasts boolean

If true, will enable notification toasts.

sourceFilter NotificationFilter

Filter with names of apps that are allowed or not allowed to raise notifications.

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

io.Connect Browser* 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

state State

Notification state. Defaults to "Active"

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

NotificationFilterobject

Description

Filter with names of apps that are allowed or not allowed to raise notifications.

Properties

Property Type Default Required Description
allowed string[]

Array of names of apps allowed to raise notifications.

blocked string[]

Array of names of apps not allowed to raise notifications.

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

io.Connect Browser* 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
state State

Notification state. Defaults to "Active"

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

(io: API, notificationDefinition: NotificationDefinition) => void

Parameters

Name Type Required Description
io API
notificationDefinition NotificationDefinition

Stateenumeration

Description

Notification states that are used by the platform when handling notifications. These states can also be used in your custom logic for processing notifications on the client or on the server side. Defaults to "Active".

  • "Active" - a notification can be marked as active when it is raised, but the user hasn't seen it, or interacted in any way with it yet;
  • "Acknowledged" - a notification can be marked as acknowledged when the user has interacted with it by clicking on the notification or on an action in it;
  • "Seen" - a notification can be marked as seen when the user has seen it (e.g., by opening the Notification Panel);
  • "Closed" - a notification can be marked as closed when the user has closed the notification in the Notification Panel;
  • "Stale" - a notification can be marked as stale after a predefined period of time;
  • "Snoozed" - a notification can be marked as snoozed when the user snoozes it from the UI;
  • "Processing" - a notification can be marked as "Processing" when its state is in the process of changing (e.g., the user interacts with a notification from the UI, you make a request to a remote service to update the notification state, and you are still waiting for a response);
  • "Active"
  • "Acknowledged"
  • "Seen"
  • "Closed"
  • "Stale"
  • "Snoozed"
  • "Processing"

  • Home
  • Privacy policy
  • Contact Us
  • interop.io
  • Overview
  • API
  • ActionClickHandler
  • Configuration
  • InteropActionSettings
  • Notification
  • NotificationAction
  • NotificationData
  • NotificationDefinition
  • NotificationFilter
  • RaiseOptions
  • Settings
  • NotificationClickHandler
  • State
Navigate
Go