2017-03-31 11:34:43 +00:00
|
|
|
var EventEmitter = require('events');
|
2017-02-24 11:18:57 +00:00
|
|
|
|
2017-07-06 22:48:20 +00:00
|
|
|
EventEmitter.prototype.request = function(requestName, cb) {
|
|
|
|
this.emit('request:' + requestName, cb);
|
|
|
|
};
|
|
|
|
|
|
|
|
EventEmitter.prototype.setCommandHandler = function(requestName, cb) {
|
|
|
|
this.on('request:' + requestName, function(_cb) {
|
|
|
|
cb.call(this, _cb);
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2017-02-24 11:18:57 +00:00
|
|
|
module.exports = EventEmitter;
|