useRecordHotkeys API
Function signature:
function useRecordHotkeys(useKey?: boolean): [Set<string>, { start: () => void, stop: () => void, isRecording: boolean }]
useKey
By default recording hotkeys will record the keys code, not the produced character. If you want to record the produced
character, you can pass true
as the first argument to the hook.
Return value
const [keys, { start, stop, isRecording }] = useRecordHotkeys()
keys
A Set
of the keys that have been pressed.
start
A function that starts recording the keys that are pressed. Only works in the browser.
stop
A function that stops recording the keys that are pressed. Only works in the browser.
isRecording
A boolean that indicates whether the recording is in progress or not.