Skip to content

A node module for sending desktop notification in electron applications

License

Notifications You must be signed in to change notification settings

hutx/electron-notification-desktop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Electron Notifications

A node module for sending desktop notification in electron applications.

screenshot

Quick Usage

const notifier = require('electron-notfier-desktop')

// Just title
notifier.notify('Notification Title')

// Full Options
notifier.notify('Notification Title', {
  message: 'This is the content of the notification. This is the content of the notification. This is the content of the notification.',
})

Installation

npm install --save electron-notification-desktop

Introduction

When you create a new notification, your notification is queued, since we only display one at a time. Each notification is a BrowserWindow instance, so it's completely cross platform.

Options

All options are optional.

  • message: A message to display under the title.
  • icon: The absolute URL of a icon displayed to the left of the text ,image size 85px* 85px.
  • duration: A notification is closed after 4.5s by default. When specifying duration to null or 0, it will never be closed automatically.

Duration after which the notification is closed

const notification = notifier.notify('Notification Title',{
  message:'I will never close automatically. I will be close automatically. I will never close automatically.',
   duration: 0,
  })

Events

In addition to the events provided by electron you also have access to the following additional events.

Clicked

When the notification was clicked, but not dragged. This usually does the default action, or closes the notification.

const notification = notifier.notify('Notification Title',{
  message:'This is the content of the notification. This is the content of the notification. This is the content of the notification.'
  })

notification.on('clicked', () => {
  notification.close()
})

About

A node module for sending desktop notification in electron applications

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published