A node module for sending notifications in nw applications.
npm install nw-notifications
More displayOptions see NotificationOptions
var Notifications = require('nw-notifications');
var notification = Notifications.create({
iconUrl: 'icon.png',
title: 'title',
message: 'message'
});
Notifications.setDefaultOptions({
iconUrl: 'icon.png'
});
Notification.setDisplayTime(20000); // notification will closed 20s later;
Default logger is console
Clear all notifications
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
});