forked from phenom/healer-man
9 lines
451 B
TypeScript
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]);
|
|
}
|