Notification Manager
A notification manager used to create Notifications to be shown to the user.
An instance of this class is always available as the inkdrop.notifications
global.
Event Subscription: Notification added
Invoke the given callback after a notification has been added.
Parameters
- Name
callback
- Type
- (notification: Notification) => void
- Description
A function which is called when a notification is added with the added notification.
Returns
Returns a Disposable on which .dispose()
can be called to unsubscribe.
Example
inkdrop.notifications.onDidAddNotification(notification => {
console.log('Notification added:', notification.getMessage())
})
Event Subscription: Notifications cleared
Invoke the given callback after the notifications have been cleared.
Parameters
- Name
callback
- Type
- () => void
- Description
A function which is called when the notifications are cleared.
Returns
Returns a Disposable on which .dispose()
can be called to unsubscribe.
Example
inkdrop.notifications.onDidClearNotifications(() => {
console.log('Notifications cleared')
})
Get Notifications
Example
const notifications = inkdrop.notifications.getNotifications()
console.log('There are', notifications.length, 'notifications')
Adding Notifications: Success
Add a success notification.
Parameters
- Name
message
- Type
- string
- Description
The message to display in the notification.
- Name
options
- Type
- object
- Description
An optional object to customize the notification.
- Name
detail
- Type
- string
- Description
The detailed description to display in the notification.
- Name
dismissable
- Type
- boolean
- Description
Whether or not the notification can be dismissed by the user. Defaults to
false
.
Returns
Returns the Notification that was added.
Example
const notification = inkdrop.notifications.addSuccess(
'Success!',
{
dismissable: true
}
)
Adding Notifications: Info
Add a info notification.
Parameters
- Name
message
- Type
- string
- Description
The message to display in the notification.
- Name
options
- Type
- object
- Description
An optional object to customize the notification.
- Name
detail
- Type
- string
- Description
The detailed description to display in the notification.
- Name
dismissable
- Type
- boolean
- Description
Whether or not the notification can be dismissed by the user. Defaults to
false
.
Returns
Returns the Notification that was added.
Example
const notification = inkdrop.notifications.addInfo(
'Info!',
{
dismissable: true
}
)
Adding Notifications: Warning
Add a warning notification.
Parameters
- Name
message
- Type
- string
- Description
The message to display in the notification.
- Name
options
- Type
- object
- Description
An optional object to customize the notification.
- Name
detail
- Type
- string
- Description
The detailed description to display in the notification.
- Name
dismissable
- Type
- boolean
- Description
Whether or not the notification can be dismissed by the user. Defaults to
false
.
Returns
Returns the Notification that was added.
Example
const notification = inkdrop.notifications.addWarning(
'Warning!',
{
dismissable: true
}
)
Adding Notifications: Error
Add a error notification.
Parameters
- Name
message
- Type
- string
- Description
The message to display in the notification.
- Name
options
- Type
- object
- Description
An optional object to customize the notification.
- Name
detail
- Type
- string
- Description
The detailed description to display in the notification.
- Name
dismissable
- Type
- boolean
- Description
Whether or not the notification can be dismissed by the user. Defaults to
false
.
Returns
Returns the Notification that was added.
Example
const notification = inkdrop.notifications.addError(
'Error!',
{
dismissable: true
}
)
Adding Notifications: Fatal Error
Add a fatal error notification.
Parameters
- Name
message
- Type
- string
- Description
The message to display in the notification.
- Name
options
- Type
- object
- Description
An optional object to customize the notification.
- Name
detail
- Type
- string
- Description
The detailed description to display in the notification.
- Name
dismissable
- Type
- boolean
- Description
Whether or not the notification can be dismissed by the user. Defaults to
false
.
Returns
Returns the Notification that was added.
Example
const notification = inkdrop.notifications.addFatalError(
'Fatal error!',
{
dismissable: true
}
)