Studio

key

("key", (string) => void): this;

Emitted when the user enters a key on the keyboard. This will only be emitted after show() has been called, even on platforms without an on-screen keyboard.

Returns

this

Handler Function

When the key event is fired, attached handler functions are called with a single argument, the key the user pressed as a string. If the user pressed the return key this value will be "\n".

Example

myKeyboard.on("key", keyPressed);

function keyPressed(k){
    if (k === "\n"){
        //code to run when the return key is pressed
    }
}
Open in new window