Notification

Represents an in-app notification. Notifications are rendered in the bottom right of the Application using the Notification Manager.


Properties

  • Name
    message
    Type
    string
    Description

    Message of the notification.

  • Name
    type
    Type
    'success' | 'info' | 'warning' | 'error' | 'fatal'
    Description

    Type of the notification.


onDidDismiss(callback)

Event Subscription: Dissmissed

Invoke the given callback when the notification is dismissed.

Parameters

  • Name
    callback
    Type
    () => void
    Description

    A function which is called when the notification is dismissed.

Returns

Returns a Disposable on which .dispose() can be called to unsubscribe.

Example

// Prepare: Create the notification
const notification = inkdrop.notifications.addInfo('Hello world!')

// Subscribe to the event
notification.onDidDismiss(() => {
  console.log('Notification dismissed')
})

onDidDisplay(callback)

Event Subscription: Displayed

Invoke the given callback when the notification is displayed.

Parameters

  • Name
    callback
    Type
    () => void
    Description

    A function which is called when the notification is displayed.

Returns

Returns a Disposable on which .dispose() can be called to unsubscribe.

Example

// Prepare: Create the notification
const notification = inkdrop.notifications.addInfo('Hello world!')

// Subscribe to the event
notification.onDidDisplay(() => {
  console.log('Notification displayed')
})

getType()

getType

Gets the type of the notification.

Parameters

No parameters

Returns

Returns the type of the notification. (e.g. 'success')

Example

// Prepare: Create the notification
const notification = inkdrop.notifications.addInfo('Hello world!')

// Get the type
notification.getType()

getMessage()

getMessage

Gets the message of the notification.

Parameters

No parameters

Returns

Returns the message of the notification.

Example

// Prepare: Create the notification
const notification = inkdrop.notifications.addInfo('Hello world!')

// Get the message
notification.getMessage()

dismiss()

dismiss

Dismisses the notification, removing it from the UI. Calling this programmatically will call all callbacks added via onDidDismiss.

Parameters

No parameters

Returns

No return value.

Example

// Prepare: Create the notification
const notification = inkdrop.notifications.addInfo('Hello world!')

// Dismiss the notification
notification.dismiss()
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!