The keyboard object allows you to configure the input for a USB keyboard connected to the player.
keyboard IDL
Code Block | ||
---|---|---|
| ||
interface keypress { attribute String type; attribute Number keyCode; attribute String key; }; callback KeyboardEventCallback = void (keypress event); interface Keyboard { Promise<bool> isAttached(); Promise<void> setLayout(String layoutName); Promise<void> setNumLock(bool on_off); void addEventListener(String type, KeyboardEventCallback callback); void removeEventListener(String type, KeyboardEventCallback callback); }; |
Object Creation
To create a keyboard object, first load the brightsign/keyboard
module using the require()
method. Then create an instance of the keyboard class.
Code Block | ||
---|---|---|
| ||
var keyboardClass = require("@brightsign/keyboard"); var keyboard = new keyboardClass(); |
Keypress
This interface contains the following parameters:
type
String: Type is always“keypress”keyCode
Number: The ASCII keycode as numberkey
String: The ASCII character for the keyboard event
Keyboard
This interface allows for detection and configuration of a USB keyboard.
...