embark/lib/core/events.js

14 lines
335 B
JavaScript
Raw Normal View History

2017-03-31 11:34:43 +00:00
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;