mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-15 16:24:40 +00:00
remove listeners for command handlers
This commit is contained in:
parent
44d6cc32df
commit
4dcd644b7c
@ -40,9 +40,12 @@ EventEmitter.prototype.request = function() {
|
||||
|
||||
EventEmitter.prototype.setCommandHandler = function(requestName, cb) {
|
||||
log("setting command handler for: ", requestName);
|
||||
return this.on('request:' + requestName, function(_cb) {
|
||||
let listener = function(_cb) {
|
||||
cb.call(this, ...arguments);
|
||||
});
|
||||
}
|
||||
// unlike events, commands can only have 1 handler
|
||||
this.removeAllListeners('request:' + requestName);
|
||||
return this.on('request:' + requestName, listener);
|
||||
};
|
||||
|
||||
EventEmitter.prototype.setCommandHandlerOnce = function(requestName, cb) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user