Simplify keyboard event API

No need for an object for three static fields.
This commit is contained in:
Pierre Ossman
2017-01-26 18:09:40 +01:00
parent 94f5cf05f3
commit d0703d1bde
4 changed files with 13 additions and 16 deletions
+4 -4
View File
@@ -47,10 +47,10 @@ Keyboard.prototype = {
// private methods
_handleRfbEvent: function (e) {
if (this._onKeyPress) {
Log.Debug("onKeyPress " + (e.type == 'keydown' ? "down" : "up") +
if (this._onKeyEvent) {
Log.Debug("onKeyEvent " + (e.type == 'keydown' ? "down" : "up") +
", keysym: " + e.keysym);
this._onKeyPress(e);
this._onKeyEvent(e.keysym, e.code, e.type == 'keydown');
}
},
@@ -138,7 +138,7 @@ make_properties(Keyboard, [
['target', 'wo', 'dom'], // DOM element that captures keyboard input
['focused', 'rw', 'bool'], // Capture and send key events
['onKeyPress', 'rw', 'func'] // Handler for key press/release
['onKeyEvent', 'rw', 'func'] // Handler for key press/release
]);
const Mouse = function (defaults) {