A browser-first rebinding system for games and interactive tools
I built Bind Manager for the kind of project that starts simple and then suddenly needs a real input layer: grouped actions, multiple slots per action, keyboard and gamepad support, persistent settings, and a remapping flow that feels at home inside the browser instead of bolted on later.
What it is designed for
My goal with this library is to make browser-side input handling feel more like a proper game or runtime system. Instead of wiring key events directly all over an app, I can register named actions, attach labels and descriptions, expose a remapping modal, and keep the runtime behavior stable even when bindings change.
- Register actions with labels, groups, default bindings, and multiple binding slots.
- Persist bindings in
localStorageand react to changes at runtime through subscriptions. - Capture both keyboard and gamepad input, including profile-aware controller naming where available.
- Show built-in input remap and controller test tools directly inside the browser UI.
API at a glance
The public API stays intentionally practical. The main entry point is createBindManager(options), and from there actions are registered, queried, and updated in one place.
createBindManager(options)sets up the manager, persistence, optional debug controls, and built-in tools.registerAction(def)orregisterActions(defs)creates the action handles your app actually listens to.- Runtime helpers like
onPressed(),onReleased(), andonHeld()keep gameplay logic decoupled from raw events. - Modal controls such as
open(),toggle(),openInputRemap(), andopenControllerTest()expose the UI without forcing a framework.
import { createBindManager } from './src/index.js';
const binds = createBindManager({
namespace: 'my-game',
builtInTools: {
inputRemap: true,
controllerTest: true,
},
});
const jump = binds.registerAction({
id: 'jump',
label: 'Jump',
group: 'Movement',
defaultBindings: ['Space', null],
});
jump.onPressed(() => {
// game logic here
});
Why it matters in practice
This is the sort of utility that pays off quickly once a prototype turns into something people actually need to configure. It gives me a consistent way to ship rebinding, hint overlays, controller testing, and persistence without having to reinvent the same input glue in every browser project.
Good fit for: browser games, sandbox tools, controller-friendly demos, or any interactive app that needs runtime remapping without a heavyweight framework.