JavaScript API for analog keyboard input.
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): stringA device instance has the following members:
startListening(handler: function<void({scancode: int, value: float}[])>)stopListening()getProductName(): stringforget()dev: HIDDeviceThe 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 PageOEM-specific keys are mapped in the 0x4__ range:
0x401 = Brightness Up0x402 = Brightness Down0x403 = Profile 10x404 = Profile 20x405 = Profile 30x408 = Profile Switch0x409 = Function Key (Fn)