forked from tj/node-growl
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
40 lines (38 loc) · 1.72 KB
/
test.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
var growl = require('./lib/growl')
growl('Support sound notifications', {title: 'Make a sound', sound: 'purr'});
growl('You have mail!')
growl('5 new messages', { sticky: true })
growl('5 new emails', { title: 'Email Client', image: 'Safari', sticky: true })
growl('Message with title', { title: 'Title'})
growl('Set priority', { priority: 2 })
growl('Show Safari icon', { image: 'Safari' })
growl('Show icon', { image: 'path/to/icon.icns' })
growl('Show image', { image: 'path/to/my.image.png' })
growl('Show png filesystem icon', { image: 'png' })
growl('Show pdf filesystem icon', { image: 'article.pdf' })
growl('Show pdf filesystem icon', { image: 'article.pdf' }, function(error) {
if (error) console.log(error);
console.log('callback');
})
growl('Show pdf filesystem icon', { title: 'Use show()', image: 'article.pdf' })
growl('here \' are \n some \\ characters that " need escaping', {}, function(error, stdout, stderr) {
if (error) throw new Error('escaping failed:\n' + stdout + stderr);
console.log('stdout:', stdout);
console.log('stderr:', stderr);
})
growl('Allow custom notifiers', { exec: 'echo XXX %s' }, function(error, stdout, stderr) {
if (error) console.error(error);
console.log('stdout:', stdout);
console.log('stderr:', stderr);
})
growl('Allow custom notifiers', { title: 'test', exec: 'echo YYY' }, function(error, stdout, stderr) {
if (error) console.error(error);
console.log('stdout:', stdout);
console.log('stderr:', stderr);
})
growl('Allow custom notifiers', { title: 'test', exec: 'echo ZZZ %s' }, function(error, stdout, stderr) {
if (error) console.error(error);
console.log('stdout:', stdout);
console.log('stderr:', stderr);
})
growl('Open a URL', { url: 'https://npmjs.org/package/growl' });