keyboard-layout-map
v1.1.0
Published
Utils for Web KeyboardLayoutMap API
Downloads
388
Readme
keyboard-layout-map
Utils for experimental Web KeyboardLayoutMap
API.
Install
npm install keyboard-layout-map
Usage
Get the current keyboard layout.
import { getKeyboardLayout } from 'keyboard-layout-map'
const layout = await getKeyboardLayout()
// ^: KeyboardLayoutMap | null
Identify the current keyboard layout.
import { identifyKeyboardLayout } from 'keyboard-layout-map'
const name = await identifyKeyboardLayout(layout)
// ^: "US" | "French" | "German" | "LatinAmerican" ...
Get all supported keyboard layouts (for testing purposes).
import * as layouts from 'keyboard-layout-map/layouts'
const ItalianLayout = layouts['Italian']
// ^: KeyboardLayoutMap
const SlovakLayout = layouts['Slovak']
// ^: KeyboardLayoutMap
License
MIT