1 | var os = require('os');
|
2 | var utils = require('./lib/utils');
|
3 |
|
4 |
|
5 | var NotifySend = require('./notifiers/notifysend');
|
6 | var NotificationCenter = require('./notifiers/notificationcenter');
|
7 | var WindowsToaster = require('./notifiers/toaster');
|
8 | var Growl = require('./notifiers/growl');
|
9 | var WindowsBalloon = require('./notifiers/balloon');
|
10 |
|
11 | var options = { withFallback: true };
|
12 |
|
13 | switch (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 | if (os.type().match(/BSD$/)) {
|
33 | module.exports = new NotifySend(options);
|
34 | module.exports.Notification = NotifySend;
|
35 | } else {
|
36 | module.exports = new Growl(options);
|
37 | module.exports.Notification = Growl;
|
38 | }
|
39 | }
|
40 |
|
41 |
|
42 | module.exports.NotifySend = NotifySend;
|
43 | module.exports.NotificationCenter = NotificationCenter;
|
44 | module.exports.WindowsToaster = WindowsToaster;
|
45 | module.exports.WindowsBalloon = WindowsBalloon;
|
46 | module.exports.Growl = Growl;
|