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 forbody
andtitle
of the system notificationtitle
(string
)body
(string
)
options
(object
) options to alter the behavior of the notificationsnoSystemNotification
(boolean
) iftrue
this skips making the system notification, subsequently theclickToFocus
option will not workclickToFocus
(object
) used to focus on a tab when the system notification is clicked.tabId
(string
) - the uuid of the tab you want focused onwindowId
(string
) - the uuid of the window that contains the tab you want focused on
inTabNotification
(object
) used to define an in tab notificationwc
(object
) - the webcontents of the tabmsg
(string
) - the message to send in the notification
In this example you have to have a tab’s
webContents
and also atab
object. It will create a system notification that will focus on the tab it relates to and will create an in tab notificationjancy.notificationFactory.create({ title: 'Update', body: "This is a message", }, { inTabNotification: { webContents, msg:"HEEEY" }, clickToFocus: { tabId: tab.uuid, windowId: tab.parentWindowId } })