mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-11 22:44:45 +00:00
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;
|