To learn more about using JavaScript in LeanFT, see Setting up and working with the JavaScript SDK.
For JavaScript code samples, see Code Samples - JavaScript.

Keyboard

Keyboard

new Keyboard()

A class that enables low-level keyboard operations.

Methods

keyDown(@param) → {Promise.<void>}

Presses and holds the specified key using a keyboard scan code.
Supports scan code set 1, such as the list shown at: http://www.computer-engineering.org/ps2keyboard/scancodes1.html.
Parameters:
Name Type Description
@param number keyScanCode The keyboard scan code of the key to hold.
Returns:
a promise that is fulfilled after pressing and holding the specified key.
Type
Promise.<void>

keyUp(keyScanCode) → {Promise.<void>}

Releases the specified key based on its keyboard scan code.
Supports scan code set 1, such as the list shown at: http://www.computer-engineering.org/ps2keyboard/scancodes1.html.
Parameters:
Name Type Description
keyScanCode number The keyboard scan code of the key to release.
Returns:
a promise that is fulfilled after releasing the specified key.
Type
Promise.<void>

pressKey(keyScanCode) → {Promise.<void>}

Presses the specified key using a keyboard scan code.
Supports scan code set 1, such as the list shown at: http://www.computer-engineering.org/ps2keyboard/scancodes1.html.
Parameters:
Name Type Description
keyScanCode number The keyboard scan code of the key.
Returns:
a promise that is fulfilled after pressing the specified key.
Type
Promise.<void>

sendString(stringToSend) → {Promise.<void>}

Types the specified string.
Parameters:
Name Type Description
stringToSend string The string to type.
Returns:
a promise that is fulfilled after typing the specified string.
Type
Promise.<void>