Input events
Everything here is on a GamepadDevice — the object you get inside manager.onConnect. Each on* method returns a disposer; call it when you unsubscribe or unmount.
const off = pad.onPress("A", () => {});
// later:
off();New to play-u1? Read Concepts and Quick start first.
Buttons
| Method | Purpose |
|---|---|
onPress / onRelease | Edge-detect a single named button. |
onHold | Repeat while held; optional delay (ms before first repeat) and interval (ms between repeats). |
onLongPress | Fire once after the button is held longer than threshold ms. |
onDoubleTap | Two presses within window ms. |
onCombo | All listed buttons held together. |
onSequence | Ordered taps within window ms. |
onAnyPress | Any named button on this device. |
Most handlers receive ButtonEvent (button, index, value). onCombo receives ButtonEvent[]; onSequence receives no arguments.
Triggers and sticks
| Method | Purpose |
|---|---|
onTrigger | Analog LT / RT when the value changes between frames. |
onTriggerPress / onTriggerRelease | Digital-style edges (default threshold 0.5); optional TriggerThresholdOptions. |
onAxisMove | Stick AxisState (x, y, magnitude) when it changes. |
onAxisFlick | up | down | left | right flicks; optional threshold and rearm. |
Snapshots vs every frame
| Method | Purpose |
|---|---|
onChange | Fires when the serializable snapshot differs from the previous frame. |
snapshot() | Current GamepadSnapshot (buttons, axes, triggers, hasVibration, …). |
onFrame | Every poll tick—use for game loops. |
Prefer onChange or snapshot() for UI and app state. Use onFrame when you want per-frame control without diffing yourself.
One-off reads
axis, isPressed, button, and trigger('LT' \| 'RT') read latest values without subscribing.
Full signatures: GamepadDevice in the API reference.