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

MethodPurpose
onPress / onReleaseEdge-detect a single named button.
onHoldRepeat while held; optional delay (ms before first repeat) and interval (ms between repeats).
onLongPressFire once after the button is held longer than threshold ms.
onDoubleTapTwo presses within window ms.
onComboAll listed buttons held together.
onSequenceOrdered taps within window ms.
onAnyPressAny named button on this device.

Most handlers receive ButtonEvent (button, index, value). onCombo receives ButtonEvent[]; onSequence receives no arguments.

Triggers and sticks

MethodPurpose
onTriggerAnalog LT / RT when the value changes between frames.
onTriggerPress / onTriggerReleaseDigital-style edges (default threshold 0.5); optional TriggerThresholdOptions.
onAxisMoveStick AxisState (x, y, magnitude) when it changes.
onAxisFlickup | down | left | right flicks; optional threshold and rearm.

Snapshots vs every frame

MethodPurpose
onChangeFires when the serializable snapshot differs from the previous frame.
snapshot()Current GamepadSnapshot (buttons, axes, triggers, hasVibration, …).
onFrameEvery 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.