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.


onDidAddNotification(callback)

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())
})

onDidClearNotifications(callback)

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')
})

getNotifications()

Get Notifications

Get all the notifications.

Parameters

No parameters.

Returns

Returns an Array of Notifications.

Example

const notifications = inkdrop.notifications.getNotifications()
console.log('There are', notifications.length, 'notifications')

addSuccess(message, [options])

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
  }
)

addInfo(message, [options])

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
  }
)

addWarning(message, [options])

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
  }
)

addError(message, [options])

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
  }
)

addFatalError(message, [options])

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
  }
)
Can you help us improve the docs? 🙏

The source of these docs is here on GitHub. If you see a way these docs can be improved, please fork us!