wip
This commit is contained in:
22
lama_cleaner/app/src/hooks/useHotkey.tsx
Normal file
22
lama_cleaner/app/src/hooks/useHotkey.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Options, useHotkeys } from 'react-hotkeys-hook'
|
||||
import { useRecoilValue } from 'recoil'
|
||||
import { appState } from '../store/Atoms'
|
||||
|
||||
const useHotKey = (
|
||||
keys: string,
|
||||
callback: any,
|
||||
options?: Options,
|
||||
deps?: any[]
|
||||
) => {
|
||||
const app = useRecoilValue(appState)
|
||||
|
||||
const ref = useHotkeys(
|
||||
keys,
|
||||
callback,
|
||||
{ ...options, enabled: !app.disableShortCuts },
|
||||
deps
|
||||
)
|
||||
return ref
|
||||
}
|
||||
|
||||
export default useHotKey
|
||||
Reference in New Issue
Block a user