Utils for experimental Web KeyboardLayoutMap
API.
npm install keyboard-layout-map
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
MIT