Rumble & snapshots
Rumble — fire haptics on a GamepadDevice when the browser exposes actuators.
Snapshots — read plain-object state from the device, or call `readPads()`` when you do not need the full manager.
Rumble on GamepadDevice
When pad.hasVibration is true, the browser exposes actuators. Helpers:
| Method | Behavior |
|---|---|
vibrate | Single pulse: intensity (0–1) and duration (ms). |
vibratePattern | On/off pattern in pattern: number[] (ms). |
vibrateDual | weak / strong motors (0–1) for duration ms. |
stopVibration | Cancels active effects. |
Each async helper accepts an optional AbortSignal for cancellation from UI or teardown.
Real hardware varies by browser, OS, and transport (Bluetooth can lag). Check hasVibration and handle rejected promises in user-facing code.
Types and edge cases: GamepadDevice in the API reference.
Snapshots without a manager
readPads() returns PadSnap[] from navigator.getGamepads(). It does not require WebHID.
import { readPads } from "@interfaces-technology/play-u1";
// or
import { readPads, type PadSnap } from "@interfaces-technology/play-u1/hid";Use readPads() for one-off reads or custom loops. For named inputs, gestures, and rumble, prefer createGamepadManager and GamepadDevice: Input events.
GamepadSnapshot vs PadSnap
GamepadSnapshot— fromGamepadDevice.snapshot()/onChange: layout-resolvedbuttons,axes,triggers, plus metadata likeidandhasVibration.PadSnap— a row fromreadPads(); lighter-weight (see TypeDoc for fields).
WebHID
Pairing HID for permissions or vendor reports is separate from rumble: WebHID.