v0.1.10 · MIT

Game controllers in the browser,
without the sharp edges.

Typed helpers on top of the browser Gamepad API: name buttons and sticks, subscribe to gestures and stick motion, tune dead zones, drive rumble, and optionally pair WebHID—so your game, tool, or kiosk UI stays small and easy to test.

Assistants & MCP

Public Streamable HTTP endpoint (no token on the default deployment): https://play-u1.vercel.app/api/mcp

Install
npm install @interfaces-technology/play-u1

Core API

Listen with names, not indices.

createGamepadManager starts polling when you subscribe. Every on* helper returns a disposer—call it to clean up when UI unmounts or levels change.

See all input events →
example.ts
import { createGamepadManager } from "@interfaces-technology/play-u1";

const manager = createGamepadManager({ deadzone: 0.12 });

manager.onConnect((pad) => {
  pad.onPress("A", () => console.log("A pressed"));
  pad.onHold("X", { delay: 400, interval: 80 }, () => console.log("X held"));
  pad.onAxisMove("LS", (e) => console.log("Left stick", e.state));
});

manager.onDisconnect((pad) => console.log("disconnected:", pad.id));

At a glance

Everything in one package

  • One manager, one poll loop

    A single requestAnimationFrame read of all pads—typed devices and disposers instead of ad hoc navigator.getGamepads glue.

  • Hardware-shaped layouts

    Xbox-style names out of the box, a generic fallback, and hooks to register profiles from gamepad.id substrings.

  • Gesture-level events

    Press, hold, long-press, double-tap, combos, sequences, and stick flicks—each subscription returns a cleanup function.

  • React hooks

    useGamepadManager, useGamepads, and useGamepadSnapshot handle start/stop and external-store sync in client components.

  • Rumble helpers

    Single pulses, patterns, and dual-motor control with optional AbortSignal cancellation.

  • Optional WebHID

    Chromium pairing helpers when you need an explicit HID session next to the standard Gamepad API.

Start here

Install from npm

Deep dive

Concepts & lifecycle

Types & classes

Generated API reference