mirror of
https://github.com/streamich/react-use.git
synced 2026-01-25 14:17:16 +00:00
Merge pull request #1273 from RobertWHurst/master
This commit is contained in:
commit
da72bfd0c9
@ -6,7 +6,7 @@ const useKeyboardJs = (combination: string | string[]) => {
|
||||
const [keyboardJs, setKeyboardJs] = useState<any>(null);
|
||||
|
||||
useMount(() => {
|
||||
import('keyboardjs').then(setKeyboardJs);
|
||||
import('keyboardjs').then(k => setKeyboardJs(k.default || k));
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
@ -16,7 +16,7 @@ const useKeyboardJs = (combination: string | string[]) => {
|
||||
|
||||
const down = event => set([true, event]);
|
||||
const up = event => set([false, event]);
|
||||
keyboardJs.bind(combination, down, up);
|
||||
keyboardJs.bind(combination, down, up, true);
|
||||
|
||||
return () => {
|
||||
keyboardJs.unbind(combination, down, up);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user