source: imaps-frontend/node_modules/react-use/esm/useKeyPressEvent.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 534 bytes
Line 
1import useKeyPressDefault from './useKeyPress';
2import useUpdateEffect from './useUpdateEffect';
3var useKeyPressEvent = function (key, keydown, keyup, useKeyPress) {
4 if (useKeyPress === void 0) { useKeyPress = useKeyPressDefault; }
5 var _a = useKeyPress(key), pressed = _a[0], event = _a[1];
6 useUpdateEffect(function () {
7 if (!pressed && keyup) {
8 keyup(event);
9 }
10 else if (pressed && keydown) {
11 keydown(event);
12 }
13 }, [pressed]);
14};
15export default useKeyPressEvent;
Note: See TracBrowser for help on using the repository browser.