mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-01-10 19:16:20 +00:00
stop event propagation with button.press if desired. fixes #64.
This commit is contained in:
parent
6f91361197
commit
e265779369
@ -5092,13 +5092,13 @@ function Button(options) {
|
||||
|
||||
this.on('keypress', function(ch, key) {
|
||||
if (key.name === 'enter' || key.name === 'space') {
|
||||
self.press();
|
||||
return self.press();
|
||||
}
|
||||
});
|
||||
|
||||
if (this.options.mouse) {
|
||||
this.on('click', function() {
|
||||
self.press();
|
||||
return self.press();
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -5109,8 +5109,9 @@ Button.prototype.type = 'button';
|
||||
|
||||
Button.prototype.press = function() {
|
||||
this.value = true;
|
||||
this.emit('press');
|
||||
var result = this.emit('press');
|
||||
delete this.value;
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user