-
Notifications
You must be signed in to change notification settings - Fork 322
/
macInput.js
41 lines (36 loc) · 880 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
const notifier = require('../');
const nc = new notifier.NotificationCenter();
const 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);
});