JavaScript API for analog keyboard input.
- Everything by Wooting
- Everything by NuPhy
- Everything by DrunkDeer
- Razer Huntsman V2 AnalogR
- Razer Huntsman Mini AnalogR
- Razer Huntsman V3 ProR
- Razer Huntsman V3 Pro MiniR
- Razer Huntsman V3 Pro TenkeylessR
- Keychron Q1 HEP, F
- Keychron Q3 HEP, F
- Keychron Q5 HEP, F
- Keychron K2 HEP, F
- Madlions MAD60HEP
- Madlions MAD68HEP
R Razer Synapse needs to be installed and running for analogue inputs to be received from this keyboard.
P The official firmware only supports polling, which can lead to lag and missed inputs.
F Custom firmware with full analog report functionality is available.
You can download and vendor the AnalogSense.js yourself, but you can also just load it straight from this repo:
<script src="https://analogsense.org/JavaScript-SDK/AnalogSense.js"></script>
Once loaded, the following global functions become available:
analogsense.getDevices(): Promise<Device[]>
analogsense.requestDevice(): Promise<Device | undefined>
analogsense.scancodeToString(scancode: number): string
A device instance has the following members:
startListening(handler: function<void({scancode: int, value: float}[])>)
stopListening()
getProductName(): string
forget()
dev: HIDDevice
The scancodes provided by this library are primarily HID scancodes; most keys are mapped as seen on usage page 0x07 (A = 0x04, B = 0x05, ...).
Control keys (usage page 0x0C) are mapped in the 0x3__
range, modulo 0x100:
0x3B5
= Next Track0x3B6
= Previous Track0x3B7
= Stop Media0x3CD
= Play/Pause0x394
= Open File Explorer0x323
= Open Browser Home Page
OEM-specific keys are mapped in the 0x4__
range:
0x401
= Brightness Up0x402
= Brightness Down0x403
= Profile 10x404
= Profile 20x405
= Profile 30x408
= Profile Switch0x409
= Function Key (Fn)