Develop with Notifications agent
How to use Notifications functionality in your plugin
Last updated
Was this helpful?
How to use Notifications functionality in your plugin
Last updated
Was this helpful?
Notifications agent gives you methods to use in your plugin to be able to push and display notifications/confirms in Dashboard, or remove displayed notifications as well
Notifications agent register it's own methods with
You can use any of these actions in your plugin.
ID
Descriptions
com.naviga.notificaion-agent:getInstance
An action returns the instance of @plugin_name with add, remove notification methods.
com.naviga.notificaion-agent:add
An action handle displaying a notification in Dashboard with the requested notification object.
com.naviga.notificaion-agent:remove
An action handle removing a notification in Dashboard "if it is displayed" with the requested notification object.
add
remove
In your plugin you can import useAction from Dashboard, so you can "import" Notification actions to your plugin.
Here we used com.naviga.notificaion-agent:getInstance
action to get and initiate our Notifications instance
Attr
Type
Default
Description
message
string
""
Message of the notification
level
string
"info"
Level of the notification. Available: success, error, warning and info
autoDismiss
int
0
Delay in seconds for the notification go away. 0 for not auto-dismiss the notification
uid
int/string
null
Notification won't be display without the uid. Notifications with same uid won't be displayed.
example for basic notification
you can send a confirm notification with your Notifications instance with add method
Attr
Type
Default
Description
message
string
null
Message of the notification
buttonTexts
array
['cancel', 'ok']
Confirm buttons texts, first item take the cancel text and the second takes the confirm text
onConfirm
function
null
callback function will be called on confirm
onCancel
function
null
callback function will be called on cancel
example for confirm notification
In order to remove a notification from the view you need to send the same "notification" object that you want to remove it. make sure you pass the same "Notification" object with the same "uid"