The KeyEvent object is received by the key event handlers onKeyDown(event) and onKeyUp(event) . The KeyEvent object is the only parameter passed to these functions and contains information about the key event.
Sample code:
function onKeyDown(event) { // The character of the key that was pressed print(event.character); }