mirror of
https://github.com/balkian/hook.io-web40.git
synced 2025-01-06 19:31:28 +00:00
First commit
This commit is contained in:
commit
c679d498f4
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
tests
|
||||||
|
configuration
|
||||||
|
node_modules
|
||||||
|
*.bak
|
||||||
|
*.swp
|
||||||
|
SOJA
|
13
bin/hook.io-web40
Executable file
13
bin/hook.io-web40
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
require('coffee-script');
|
||||||
|
var Hook = require('../lib/hook.io-web40').Web40Hook;
|
||||||
|
|
||||||
|
var hook = new Hook({
|
||||||
|
name: "Web40Hook"
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// Hook.start defaults to localhost
|
||||||
|
// it can accept dnode constructor options ( for remote connections )
|
||||||
|
// these hooks can be started on diffirent machines / networks / devices
|
||||||
|
hook.connect();
|
1
config.json
Normal file
1
config.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{}
|
2
index.js
Normal file
2
index.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
require('coffee-script');
|
||||||
|
module.exports = require('./lib/hook.io-web40');
|
19
lib/hook.io-web40.coffee
Normal file
19
lib/hook.io-web40.coffee
Normal 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
|
24
package.json
Normal file
24
package.json
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"author": "J.Fernando Sánchez <balkian@gmail.com>",
|
||||||
|
"name": "hook.io-web40",
|
||||||
|
"description": "Basic hook for the web4.0 project",
|
||||||
|
"keywords" : [ "hook", "hook.io" ],
|
||||||
|
"version": "0.0.1",
|
||||||
|
"bugs" : { "url" : "http://github.com/balkian/hook.io-web40/issues" },
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/balkian/hook.io-web40.git"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"hookio-mailer": "./bin/hook.io-web40"
|
||||||
|
},
|
||||||
|
"main": "./lib/hook.io-web40",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= v0.4.7"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"hook.io" : ">= 0.8",
|
||||||
|
"coffee-script" : "*"
|
||||||
|
},
|
||||||
|
"devDependencies": {}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user