NotificationHub
Used to send notifications. Extends MessageHub.
- Module:
platform-core
- Source: platform-core/ui/platform/notification-hub.js
- Web Link:
/services/web/platform-core/ui/platform/notification-hub.js
- Status:
stable
- Group:
platform
Basic Usage
If you are using the standard Dirigible view configuration, notification support is enabled automatically.
If you are making a custom view, you can include the API using the web link above.
To initialize it, place this in your code:
const notificationHub = new NotificationHub();
Functions
Function | Description | Returns |
---|---|---|
show(NotifyObject) | Shows a notification. | object |
onShow(handlerFunc) | Registers a listener. Triggered when a notification should be shown. Returns a function to unregister the listener. | function |
Typedefs
Note
Params in square brackets are optional.
NotifyObject : Object
Param | Type | Description |
---|---|---|
type | 'information' | 'warning' | 'negative' | 'positive' |
Type of notification. |
title | string |
Notification title. |
description | string |
Notification description. |
Example
notificationHub.show({
type: 'information',
title: 'Information',
description: 'This is used to show information.',
});
For a full example you can look at sample-platform.