Skip to main content Link Search Menu Expand Document (external link)

The Notification Factory Interface

With the Notification Factory you can create either a system notification or an in tab notification.

There is only one notification factory interface and it can always be found at jancy.notificationFactory.

Methods

notificationFactory.create(notificationOptions, options)

  • notificationOptions (object) options to override the defaults used by the factory for body and title of the system notification
    • title (string)
    • body (string)
  • options (object) options to alter the behavior of the notifications
    • noSystemNotification (boolean) if true this skips making the system notification, subsequently the clickToFocus option will not work
    • clickToFocus (object) used to focus on a tab when the system notification is clicked.
      • tabId (string) - the uuid of the tab you want focused on
      • windowId (string) - the uuid of the window that contains the tab you want focused on
    • inTabNotification (object) used to define an in tab notification
      • wc (object) - the webcontents of the tab
      • msg (string) - the message to send in the notification

In this example you have to have a tab’s webContents and also a tab object. It will create a system notification that will focus on the tab it relates to and will create an in tab notification

     jancy.notificationFactory.create({
       title: 'Update',
       body: "This is a message",
     },
     {
       inTabNotification: {
         webContents, msg:"HEEEY"
       },
       clickToFocus: {
         tabId: tab.uuid,
         windowId: tab.parentWindowId 
       }
     })