1
0
mirror of https://github.com/balkian/hook.io-web40.git synced 2024-10-31 20:51:41 +00:00
hook.io-web40/lib/hook.io-web40.coffee

20 lines
558 B
CoffeeScript
Raw Normal View History

2012-05-25 09:23:09 +00:00
# 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