growl-notifier.coffee | |
---|---|
IntroductionThis is a usage example of the connFu node DSL. This
application must be run from the command line in an OSX machine
with Grow and Once launched, it listens to all the configured events in the application and shows them as a Growl notification Running this example
| |
Annotated source | |
Require | connFu = require 'connfu'
growl = require 'growl' |
Check that we receive the | if process.argv.length < 3
console.log "Usage: coffee grow-notifier.coffee <application_token>"
process.exit 1 |
Check if we have If | growl.binVersion (err, version) ->
if err
console.log "'growlnotifier' is required in order to run this application"
process.exit 1 |
Create the connFu application | connFu.createApp
apiKey: process.argv[2]
handlers: |
When receiving any kind of event, send a notification to Growl | voice:
join: (call) ->
growl.notify "The number #{call.from} joined to the conference with number #{call.to}"
leave: (call) ->
growl.notify "The number #{call.from} left the conference with number #{call.to}"
twitter:
new: (tweet) ->
growl.notify tweet.content, title: "New Tweet from #{tweet.from}"
sms:
new: (sms) ->
growl.notify sms.content, title: "New SMS from #{sms.from}" |
Listen to | .listen()
|