39c8b14f |
1 | # Growl for nodejs |
2 | |
3 | Growl support for Nodejs. This is essentially a port of my [Ruby Growl Library](http://github.com/visionmedia/growl). Ubuntu/Linux support added thanks to [@niftylettuce](http://github.com/niftylettuce). |
4 | |
5 | ## Installation |
6 | |
7 | ### Install |
8 | |
9 | ### Mac OS X (Darwin): |
10 | |
11 | Install [growlnotify(1)](http://growl.info/extras.php#growlnotify). On OS X 10.8, Notification Center is supported using [terminal-notifier](https://github.com/alloy/terminal-notifier). To install: |
12 | |
13 | $ sudo gem install terminal-notifier |
14 | |
15 | Install [npm](http://npmjs.org/) and run: |
16 | |
17 | $ npm install growl |
18 | |
19 | ### Ubuntu (Linux): |
20 | |
21 | Install `notify-send` through the [libnotify-bin](http://packages.ubuntu.com/libnotify-bin) package: |
22 | |
23 | $ sudo apt-get install libnotify-bin |
24 | |
25 | Install [npm](http://npmjs.org/) and run: |
26 | |
27 | $ npm install growl |
28 | |
29 | ### Windows: |
30 | |
31 | Download and install [Growl for Windows](http://www.growlforwindows.com/gfw/default.aspx) |
32 | |
33 | Download [growlnotify](http://www.growlforwindows.com/gfw/help/growlnotify.aspx) - **IMPORTANT :** Unpack growlnotify to a folder that is present in your path! |
34 | |
35 | Install [npm](http://npmjs.org/) and run: |
36 | |
37 | $ npm install growl |
38 | |
39 | ## Examples |
40 | |
41 | Callback functions are optional |
42 | |
43 | var growl = require('growl') |
44 | growl('You have mail!') |
45 | growl('5 new messages', { sticky: true }) |
46 | growl('5 new emails', { title: 'Email Client', image: 'Safari', sticky: true }) |
47 | growl('Message with title', { title: 'Title'}) |
48 | growl('Set priority', { priority: 2 }) |
49 | growl('Show Safari icon', { image: 'Safari' }) |
50 | growl('Show icon', { image: 'path/to/icon.icns' }) |
51 | growl('Show image', { image: 'path/to/my.image.png' }) |
52 | growl('Show png filesystem icon', { image: 'png' }) |
53 | growl('Show pdf filesystem icon', { image: 'article.pdf' }) |
54 | growl('Show pdf filesystem icon', { image: 'article.pdf' }, function(err){ |
55 | // ... notified |
56 | }) |
57 | |
58 | ## Options |
59 | |
60 | - title |
61 | - notification title |
62 | - name |
63 | - application name |
64 | - priority |
65 | - priority for the notification (default is 0) |
66 | - sticky |
67 | - weither or not the notification should remainin until closed |
68 | - image |
69 | - Auto-detects the context: |
70 | - path to an icon sets --iconpath |
71 | - path to an image sets --image |
72 | - capitalized word sets --appIcon |
73 | - filename uses extname as --icon |
74 | - otherwise treated as --icon |
75 | |
76 | ## License |
77 | |
78 | (The MIT License) |
79 | |
80 | Copyright (c) 2009 TJ Holowaychuk <tj@vision-media.ca> |
81 | |
82 | Permission is hereby granted, free of charge, to any person obtaining |
83 | a copy of this software and associated documentation files (the |
84 | 'Software'), to deal in the Software without restriction, including |
85 | without limitation the rights to use, copy, modify, merge, publish, |
86 | distribute, sublicense, and/or sell copies of the Software, and to |
87 | permit persons to whom the Software is furnished to do so, subject to |
88 | the following conditions: |
89 | |
90 | The above copyright notice and this permission notice shall be |
91 | included in all copies or substantial portions of the Software. |
92 | |
93 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
94 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
95 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
96 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
97 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
98 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
99 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |