mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-05-07 01:02:36 +00:00
chore: update prettier tab width for consistency (#175)
This commit is contained in:
parent
a931f8c69c
commit
f24d2fcc99
247 changed files with 7224 additions and 7375 deletions
|
@ -1,19 +1,19 @@
|
|||
import { useEffect } from 'react';
|
||||
|
||||
export const globalOnKeyUp = (
|
||||
key: string[],
|
||||
action: () => any,
|
||||
isActive: boolean = true
|
||||
key: string[],
|
||||
action: () => any,
|
||||
isActive: boolean = true
|
||||
) => {
|
||||
useEffect(() => {
|
||||
const onKeyUp = (event: KeyboardEvent) => {
|
||||
if (isActive && key.includes(event.key)) {
|
||||
action();
|
||||
}
|
||||
};
|
||||
useEffect(() => {
|
||||
const onKeyUp = (event: KeyboardEvent) => {
|
||||
if (isActive && key.includes(event.key)) {
|
||||
action();
|
||||
}
|
||||
};
|
||||
|
||||
document.body.addEventListener('keyup', onKeyUp);
|
||||
document.body.addEventListener('keyup', onKeyUp);
|
||||
|
||||
return () => document.body.removeEventListener('keyup', onKeyUp);
|
||||
}, [key, action, isActive]);
|
||||
return () => document.body.removeEventListener('keyup', onKeyUp);
|
||||
}, [key, action, isActive]);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue