Skip to content

Instantly share code, notes, and snippets.

@FLYBYME
Created February 20, 2013 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FLYBYME/867bff6342130a049757 to your computer and use it in GitHub Desktop.
Save FLYBYME/867bff6342130a049757 to your computer and use it in GitHub Desktop.
var Hook = require('hook.io').Hook;
var a = new Hook({
name : 'a',
debug : false
});
var b = new Hook({
name : 'b',
debug : false
});
a.on('hook::ready', function() {
a.on('*::' + a.name + '::reply', function() {
console.log('reply')
console.log('reply')
console.log('reply')
console.log('reply')
console.log('reply')
console.log('reply')
console.log('reply')
})
b.start();
})
b.on('hook::ready', function() {
b.on('*::test', function(data) {
var name = this.event.split('::')[0]
console.log(name)
b.emit(name + '::reply')
})
a.emit('test')
})
a.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment