AbstractKeyboard($protected) ARCore/keyboards/abstract_keyboard.js, line 156
Constructs a new AbstractKeyboard. Subclasses should call this to get a
basic keyboard before extending it with a concrete implementation.
Subclasses should pass in an object as $protected, which will be
populated with keydown(key) and keyup(keydownId), which allow
keyboards to simulate a key being pressed or released. key is either a
printable character or one of the constants that is in
AbstractKeyboard.KEYS to represent special keys: TAB, BACKSPACE,
ENTER, LEFT, and RIGHT. keydown returns an id that
can be passed to keyup to mark that key as released.
AbstractKeyboards are not frozen, so you can subclass AbstractKeyboard using parasitic inheritance:
function MySpecialKeyboard() {
var $protected = {};
var self = AbstractKeyboard($protected);
self.pressAKeyRepeatedly = function(key, numTimes) {
for(var i = 0; i < numTimes; i++) {
$protected.keyup($protected.keydown(key));
}
};
Object.freeze(self);
return self;
}
| Argument | Type | Description |
|---|---|---|
$protected |
Object | Subclasses should pass an object for this argument. It will be populated with protected members available only to subclasses. |
Instance Methods
-
dismiss() ARCore/keyboards/abstract_keyboard.js, line 270
-
Dismisses the keyboard.
-
keyPressed(handler) ARCore/keyboards/abstract_keyboard.js, line 279
-
Binds a handler to the keypress event.
Argument Type Description handlerfunction Handler to bind