Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including electron-notifications with all npm packages installed. Try it out:

var electronNotifications = require("electron-notifications")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

electron-notifications v1.0.0

A node module for sending notifications in electron applications

Electron Notifications

A node module for sending notifications in electron applications.


Quick Usage

const notifier = require('electron-notifications')

// Just title

// Full Options
notifier.notify('Calendar', {
  message: 'Event begins in 10 minutes',
  icon: '',
  buttons: ['Dismiss', 'Snooze'],


npm install --save electron-notifications


If you'd like to see this in action you can run the playbook and try out live examples and edit the code in place.

git clone
npm run playbook


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.


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.
  • buttons: One or two buttons to display on the right of the notification.
  • vertical: Boolean (default: false) that specifies that the buttons should be stacked vertically.
  • duration: Integer duration in milliseconds (default: 4000) to show the notification.
  • flat: Boolean (default: false) that specifies to use a flat button style notification.


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


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

const notification = notifier.notify('Calendar')

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

Swiped Right

When the notification has been swiped to the right. This usually indicates that the user wants to dismiss the notification.

const notification = notifier.notify('Calendar')

notification.on('swipedRight', () => {

Button Clicked

When any one of the buttons are clicked, it'll trigger a buttonClicked event, and pass the text, button index and options to the handler.

const notification = notifier.notify('Calendar', {
  buttons: ['Dismiss', 'Snooze'],
  url: ""

notification.on('buttonClicked', (text, buttonIndex, options) => {
  if (text === 'Snooze') {
    // Snooze!
  } else if(buttonIndex === 1) {
    //open options.url


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free