1
0
mirror of https://github.com/balkian/hook.io-web40.git synced 2025-09-02 10:02:21 +00:00

First commit

This commit is contained in:
J.Fernando Sánchez
2012-05-25 11:23:09 +02:00
commit c679d498f4
6 changed files with 65 additions and 0 deletions

19
lib/hook.io-web40.coffee Normal file
View File

@@ -0,0 +1,19 @@
# Imports
Hook = require('hook.io').Hook
class Web40Hook extends Hook
constructor: (options) ->
self = this
Hook.call(self, options)
self.on 'hook::ready', ->
self.on '*::kill', (data,fn) ->
if data? && data == self.name
console.log "Shutting down, Sir"
fn(true)
self.kill()
self.on '*::ping', (data,fn) ->
self.emit 'pong', {'name':self.name}
fn(self.name)
module.exports.Web40Hook = Web40Hook