-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
macInput.js
45 lines (38 loc) · 1.02 KB
/
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
42
43
44
45
/* eslint-disable no-console */
const notifier = require('../');
const nc = new notifier.NotificationCenter();
const trueAnswer = 'Yessir.';
/*
@note : closeLabel is case sensitive
*/
nc.notify(
{
title: 'Notifications',
message: 'Do you like them?',
sound: 'Funk',
closeLabel: 'Nope',
actions: trueAnswer
},
function (err, response, metadata) {
if (err) throw err;
console.log(metadata);
if (metadata.activationValue !== trueAnswer) {
return; // Do not continue
}
nc.notify(
{
title: 'Notifications',
message: 'Do you wish to reply to them?',
sound: 'Funk',
reply: true
},
function (err, response, metadata) {
if (err) throw err;
console.log(metadata);
}
);
}
);
nc.on('replied', function (obj, options, metadata) {
console.log('User has replied', metadata);
});