Index

Index

Type aliases

CustomData

CustomData: any

User-defined context data that can be attached to Notifications.

Notification

Notification: Required<NotificationOptions>

A fully hydrated form of the NotificationOptions.

Events

NotificationButtonClickedEvent

NotificationButtonClickedEvent:

Event fired whenever the Notification has been clicked.

This will not fire in cases of non-buttons being clicked. See NotificationClickedEvent.

buttonIndex

buttonIndex: number

notification

notification: Notification

type

type: "notification-button-clicked"

NotificationClickedEvent

NotificationClickedEvent:

Event fired whenever the Notification has been clicked on.

This will not fire in cases of Notification Buttons being clicked. See NotificationButtonClickedEvent.

notification

notification: Notification

type

type: "notification-clicked"

NotificationClosedEvent

NotificationClosedEvent:

Event fired whenever the Notification has been closed.

notification

notification: Notification

type

type: "notification-closed"

Functions

addEventListener

  • addEventListener(eventType: "notification-clicked", listener: function): void
  • addEventListener(eventType: "notification-closed", listener: function): void
  • addEventListener(eventType: "notification-button-clicked", listener: function): void

clear

  • clear(id: string): Promise<boolean>
  • Clears a specific Notification from the Notification Center.

    Returns true if the Notification was successfully cleared. Returns false if the Notification was not cleared, without errors.

    import {clear} from 'openfin-notifications';
    
    clear("uniqueNotificationId");

    Parameters

    • id: string

      ID of the Notification to clear.

    Returns Promise<boolean>

clearAll

  • clearAll(): Promise<number>
  • Clears all Notifications which were created by the calling application, including child windows.

    Returns the number of successfully cleared Notifications.

    import {clearAll} from 'openfin-notifications';
    
    clearAll();

    Returns Promise<number>

create

  • Creates a new Notification.

    The Notification will appear in the Notification Center and as a toast if the Center is not visible.

    If a Notification is created with an id of an already existing Notification, the existing Notification will be recreated with the new content.

    import {create} from 'openfin-notifications';
    
    create({
         id: "uniqueNotificationId",
         body: "I'm the Notification body text",
         icon: "https://openfin.co/favicon.ico"
    });

    Parameters

    Returns Promise<Notification>

getAll

  • Retrieves all Notifications which were created by the calling application, including child windows.

    import {getAll} from 'openfin-notifications'
    
    getAll()
     .then(console.log);

    Returns Promise<Notification[]>

removeEventListener

  • removeEventListener(eventType: "notification-clicked", listener: function): void
  • removeEventListener(eventType: "notification-closed", listener: function): void
  • removeEventListener(eventType: "notification-button-clicked", listener: function): void

toggleNotificationCenter

  • toggleNotificationCenter(): Promise<void>
  • Toggles the visibility of the Notification Center.

    import {toggleNotificationCenter} from 'openfin-notifications';
    
    toggleNotificationCenter();

    Returns Promise<void>