source: imaps-frontend/node_modules/react-use/lib/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: 712 bytes
RevLine 
[d565449]1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var tslib_1 = require("tslib");
4var useKeyPress_1 = tslib_1.__importDefault(require("./useKeyPress"));
5var useUpdateEffect_1 = tslib_1.__importDefault(require("./useUpdateEffect"));
6var useKeyPressEvent = function (key, keydown, keyup, useKeyPress) {
7 if (useKeyPress === void 0) { useKeyPress = useKeyPress_1.default; }
8 var _a = useKeyPress(key), pressed = _a[0], event = _a[1];
9 useUpdateEffect_1.default(function () {
10 if (!pressed && keyup) {
11 keyup(event);
12 }
13 else if (pressed && keydown) {
14 keydown(event);
15 }
16 }, [pressed]);
17};
18exports.default = useKeyPressEvent;
Note: See TracBrowser for help on using the repository browser.