mirror of https://github.com/embarklabs/embark.git
14 lines
335 B
JavaScript
14 lines
335 B
JavaScript
var EventEmitter = require('events');
|
|
|
|
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);
|
|
});
|
|
};
|
|
|
|
module.exports = EventEmitter;
|