Skip to content

key

Studio is being deprecated, please head over to the documentation page for Mattercraft, our most advanced 3D tool for the web, where you can find the most recent information and tutorials.

("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.

this

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”.

myKeyboard.on("key", keyPressed);
function keyPressed(k){
if (k === "\n"){
//code to run when the return key is pressed
}
}