test.js 1.4 KB

12345678910111213141516171819202122232425262728293031
  1. var growl = require('./lib/growl')
  2. growl('Support sound notifications', {title: 'Make a sound', sound: 'purr'});
  3. growl('You have mail!')
  4. growl('5 new messages', { sticky: true })
  5. growl('5 new emails', { title: 'Email Client', image: 'Safari', sticky: true })
  6. growl('Message with title', { title: 'Title'})
  7. growl('Set priority', { priority: 2 })
  8. growl('Show Safari icon', { image: 'Safari' })
  9. growl('Show icon', { image: 'path/to/icon.icns' })
  10. growl('Show image', { image: 'path/to/my.image.png' })
  11. growl('Show png filesystem icon', { image: 'png' })
  12. growl('Show pdf filesystem icon', { image: 'article.pdf' })
  13. growl('Show pdf filesystem icon', { image: 'article.pdf' }, function(){
  14. console.log('callback');
  15. })
  16. growl('Show pdf filesystem icon', { title: 'Use show()', image: 'article.pdf' })
  17. growl('here \' are \n some \\ characters that " need escaping', {}, function(error, stdout, stderr) {
  18. if (error) throw new Error('escaping failed:\n' + stdout + stderr);
  19. })
  20. growl('Allow custom notifiers', { exec: 'echo XXX %s' }, function(error, stdout, stderr) {
  21. console.log(stdout);
  22. })
  23. growl('Allow custom notifiers', { title: 'test', exec: 'echo YYY' }, function(error, stdout, stderr) {
  24. console.log(stdout);
  25. })
  26. growl('Allow custom notifiers', { title: 'test', exec: 'echo ZZZ %s' }, function(error, stdout, stderr) {
  27. console.log(stdout);
  28. })
  29. growl('Open a URL', { url: 'https://npmjs.org/package/growl' });