From af0d366aeeb9e753686189be65d0d57e07d3a1ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Wed, 31 Jan 2024 16:10:42 +0400 Subject: [PATCH] Added clean keys while recording --- src/useRecordHotkeys.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/useRecordHotkeys.ts b/src/useRecordHotkeys.ts index d66296e8..7449d759 100644 --- a/src/useRecordHotkeys.ts +++ b/src/useRecordHotkeys.ts @@ -43,5 +43,9 @@ export default function useRecordHotkeys() { } }, [handler, stop]) - return [keys, { start, stop, isRecording }] as const + const resetKeys = useCallback(() => { + setKeys(new Set()) + }, []) + + return [keys, { start, stop, resetKeys, isRecording }] as const }