UNPKG

1.32 kBJavaScriptView Raw
1var os = require('os');
2var utils = require('./lib/utils');
3
4// All notifiers
5var NotifySend = require('./notifiers/notifysend');
6var NotificationCenter = require('./notifiers/notificationcenter');
7var WindowsToaster = require('./notifiers/toaster');
8var Growl = require('./notifiers/growl');
9var WindowsBalloon = require('./notifiers/balloon');
10
11var options = { withFallback: true };
12
13switch(os.type()) {
14 case 'Linux':
15 module.exports = new NotifySend(options);
16 module.exports.Notification = NotifySend;
17 break;
18 case 'Darwin':
19 module.exports = new NotificationCenter(options);
20 module.exports.Notification = NotificationCenter;
21 break;
22 case 'Windows_NT':
23 if (utils.isLessThanWin8()) {
24 module.exports = new WindowsBalloon(options);
25 module.exports.Notification = WindowsBalloon;
26 } else {
27 module.exports = new WindowsToaster(options);
28 module.exports.Notification = WindowsToaster;
29 }
30 break;
31 default:
32 module.exports = new Growl(options);
33 module.exports.Notification = Growl;
34}
35
36// Expose notifiers to give full control.
37module.exports.NotifySend = NotifySend;
38module.exports.NotificationCenter = NotificationCenter;
39module.exports.WindowsToaster = WindowsToaster;
40module.exports.WindowsBalloon = WindowsBalloon;
41module.exports.Growl = Growl;