The KeyboardEvent is passed into all event callbacks from the Keyboard. It corresponds to a key press or release.
Create a new KeyboardEvent.
The keyboard object which is firing the event.
The original browser event that was fired.
const onKeyDown = function (e) { if (e.key === pc.KEY_SPACE) { // space key pressed } e.event.preventDefault(); // Use original browser event to prevent browser action.};app.keyboard.on("keydown", onKeyDown, this); Copy
const onKeyDown = function (e) { if (e.key === pc.KEY_SPACE) { // space key pressed } e.event.preventDefault(); // Use original browser event to prevent browser action.};app.keyboard.on("keydown", onKeyDown, this);
The element that fired the keyboard event.
The original browser event which was fired.
The keyCode of the key that has changed. See the KEY_* constants.
The KeyboardEvent is passed into all event callbacks from the Keyboard. It corresponds to a key press or release.