forked from mikaelbr/node-notifier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
macInput.js
41 lines (36 loc) · 874 Bytes
/
macInput.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
var notifier = require('../');
var nc = new notifier.NotificationCenter();
var trueAnswer = 'Most def.';
nc.notify(
{
title: 'Notifications',
message: 'Are they cool?',
sound: 'Funk',
// case sensitive
closeLabel: 'Absolutely not',
actions: trueAnswer
},
function(err, response, metadata) {
if (err) throw err;
console.log(metadata);
if (metadata.activationValue !== trueAnswer) {
return; // No need to continue
}
nc.notify(
{
title: 'Notifications',
message: 'Do you want to reply to them?',
sound: 'Funk',
// case sensitive
reply: true
},
function(err, response, metadata) {
if (err) throw err;
console.log(metadata);
}
);
}
);
nc.on('replied', function(obj, options, metadata) {
console.log('User replied', metadata);
});