Table of Contents

Class Keyboard

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll
NOTE
Experimental
The Keyboard interface of the {{domxref("Keyboard API", "", "", "nocode")}} provides functions that retrieve keyboard layout maps and toggle capturing of key presses from the physical keyboard.
[Value("Keyboard")]
public class Keyboard : EventTarget
Inheritance
Keyboard
Inherited Members

Remarks

A list of valid code values is found in the UI Events KeyboardEvent code Values spec.

See also on MDN

Constructors

Keyboard()

public Keyboard()

Properties

Onlayoutchange

[Value("onlayoutchange")]
public EventHandlerNonNull Onlayoutchange { get; set; }

Property Value

EventHandlerNonNull

Methods

GetLayoutMap()

NOTE
Experimental
The getLayoutMap() method of the
Keyboard interface returns a {{jsxref('Promise')}} that resolves with
an instance of 'KeyboardLayoutMap' which is a map-like object with
functions for retrieving the strings associated with specific physical keys.
[Value("getLayoutMap")]
public Task<KeyboardLayoutMap> GetLayoutMap()

Returns

Task<KeyboardLayoutMap>

A 'Promise' that resolves with an instance of
'KeyboardLayoutMap'.

Remarks

Lock(List<string>)

NOTE
Experimental
The lock() method of the
Keyboard interface returns a {{jsxref('Promise')}} that resolves after enabling the
capture of key presses for any or all of the keys on the physical keyboard. This method
can only capture keys that are granted access by the underlying operating
system.
[Value("lock")]
public Task<GlobalObject.Undefined> Lock(List<string> keyCodes = null)

Parameters

keyCodes List<string>

Returns

Task<GlobalObject.Undefined>

A 'Promise' that resolves with 'undefined' when the lock was successful.

Remarks

If lock() is called multiple times then only the key codes specified in the most recent call will be locked.
Any keys locked by a previous call to lock() are unlocked.

See also on MDN

Unlock()

NOTE
Experimental
The unlock() method of the
Keyboard interface unlocks all keys captured by the
'Keyboard.Lock' method and returns synchronously.
[Value("unlock")]
public GlobalObject.Undefined Unlock()

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks