Files
healer-man/src/input/useInputBindingLabels.ts
T
2026-09-11 14:26:15 -04:00

9 lines
451 B
TypeScript

import { useSyncExternalStore } from "react";
import { getInputPreferences, subscribeInputPreferences } from "./keybindRuntime";
import { inputBindingLabel, type InputDevice } from "./keybinds";
export function useInputBindingLabels() {
const preferences = useSyncExternalStore(subscribeInputPreferences, getInputPreferences, getInputPreferences);
return (device: InputDevice, id: string) => inputBindingLabel(device, preferences[device][id]);
}