Skip to content

A node module for sending notifications in nw applications.

Notifications You must be signed in to change notification settings

zxfrank/nw-notifications

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nw-notifications

A node module for sending notifications in nw applications.

Install

npm install nw-notifications

Usage

Notifications.create(options)

More displayOptions see NotificationOptions

var Notifications = require('nw-notifications');
var notification = Notifications.create({
  iconUrl: 'icon.png',
  title: 'title',
  message: 'message'
});

Notifications.setDefaultOptions(options)

Notifications.setDefaultOptions({
  iconUrl: 'icon.png'
});

Notifications.setDisplayTime(delay)

Notification.setDisplayTime(20000); // notification will closed 20s later;

Notifications.setLogger(logger)

Default logger is console

Notifications.clear()

Clear all notifications

events

notification.on('shown', function () {
  // displayed
});

notification.on('clicked', function () {
  // clicked message body
});

notification.on('closed', function (reason) {
  console.log(reason); 
  // CLOSED_BY_USER
  // CLOSED_BY_TIMEOUT
  // CLOSED_BY_CLICK
});

About

A node module for sending notifications in nw applications.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 83.7%
  • HTML 16.3%