improve debug logging

This commit is contained in:
Michael Peters 2024-01-27 18:32:01 -08:00
parent c187a8625f
commit f9f0b42473

View File

@ -111,13 +111,20 @@ function useKeyPress(
) { ) {
useEffect(() => { useEffect(() => {
const listener = (eventRaw: Event) => { const listener = (eventRaw: Event) => {
console.log('eventRaw', eventRaw); console.log(
console.log('callback', callback); 'eventRaw',
console.log('key', key); eventRaw,
console.log('ctrlKey', ctrlKey); 'callback',
callback,
'key',
key,
'ctrlKey',
ctrlKey
);
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
const event = eventRaw as any as KeyboardEvent; const event = eventRaw as any as KeyboardEvent;
if (event.key === key && event.ctrlKey === ctrlKey) { if (event.key === key && event.ctrlKey === ctrlKey) {
console.log(`calling event for ${key} ${ctrlKey}`);
callback(event); callback(event);
} }
}; };