Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-hot-keys

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-hot-keys - npm Package Compare versions

Comparing version 2.0.0-beta.1 to 2.0.0-beta.2

62

lib/cjs/index.js
"use strict";
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var PropTypes = _interopRequireWildcard(require("prop-types"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _hotkeysJs = _interopRequireDefault(require("hotkeys-js"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _react = _interopRequireDefault(require("react"));
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
var PropTypes = _interopRequireWildcard(require("prop-types"));
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var _hotkeysJs = _interopRequireDefault(require("hotkeys-js"));
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var ReactHotkeys =
/*#__PURE__*/
function (_React$Component) {
_inherits(ReactHotkeys, _React$Component);
(0, _inherits2.default)(ReactHotkeys, _React$Component);

@@ -44,10 +38,9 @@ function ReactHotkeys(props) {

_classCallCheck(this, ReactHotkeys);
_this = _possibleConstructorReturn(this, _getPrototypeOf(ReactHotkeys).call(this, props));
(0, _classCallCheck2.default)(this, ReactHotkeys);
_this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(ReactHotkeys).call(this, props));
_this.isKeyDown = false;
_this.handle = void 0;
_this.onKeyDown = _this.onKeyDown.bind(_assertThisInitialized(_this));
_this.onKeyUp = _this.onKeyUp.bind(_assertThisInitialized(_this));
_this.handleKeyUpEvent = _this.handleKeyUpEvent.bind(_assertThisInitialized(_this));
_this.onKeyDown = _this.onKeyDown.bind((0, _assertThisInitialized2.default)(_this));
_this.onKeyUp = _this.onKeyUp.bind((0, _assertThisInitialized2.default)(_this));
_this.handleKeyUpEvent = _this.handleKeyUpEvent.bind((0, _assertThisInitialized2.default)(_this));
_this.handle = {};

@@ -57,3 +50,3 @@ return _this;

_createClass(ReactHotkeys, [{
(0, _createClass2.default)(ReactHotkeys, [{
key: "componentDidMount",

@@ -64,8 +57,8 @@ value: function componentDidMount() {

if (filter) {
_hotkeysJs["default"].filter = filter;
_hotkeysJs.default.filter = filter;
}
_hotkeysJs["default"].unbind(this.props.keyName);
_hotkeysJs.default.unbind(this.props.keyName);
(0, _hotkeysJs["default"])(this.props.keyName, this.onKeyDown);
(0, _hotkeysJs.default)(this.props.keyName, this.onKeyDown);
document && document.body.addEventListener('keyup', this.handleKeyUpEvent);

@@ -76,3 +69,3 @@ }

value: function componentWillUnmount() {
_hotkeysJs["default"].unbind(this.props.keyName);
_hotkeysJs.default.unbind(this.props.keyName);

@@ -113,7 +106,6 @@ this.isKeyDown = true;

}]);
return ReactHotkeys;
}(_react["default"].Component);
}(_react.default.Component);
exports["default"] = ReactHotkeys;
exports.default = ReactHotkeys;
ReactHotkeys.defaultProps = {

@@ -120,0 +112,0 @@ filter: function filter(event) {

@@ -1,36 +0,11 @@

"use strict";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import React from 'react';
import * as PropTypes from 'prop-types';
import Hotkeys from 'hotkeys-js';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var PropTypes = _interopRequireWildcard(require("prop-types"));
var _hotkeysJs = _interopRequireDefault(require("hotkeys-js"));
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var ReactHotkeys =

@@ -62,8 +37,7 @@ /*#__PURE__*/

if (filter) {
_hotkeysJs["default"].filter = filter;
Hotkeys.filter = filter;
}
_hotkeysJs["default"].unbind(this.props.keyName);
(0, _hotkeysJs["default"])(this.props.keyName, this.onKeyDown);
Hotkeys.unbind(this.props.keyName);
Hotkeys(this.props.keyName, this.onKeyDown);
document && document.body.addEventListener('keyup', this.handleKeyUpEvent);

@@ -74,4 +48,3 @@ }

value: function componentWillUnmount() {
_hotkeysJs["default"].unbind(this.props.keyName);
Hotkeys.unbind(this.props.keyName);
this.isKeyDown = true;

@@ -113,5 +86,4 @@ this.handle = {};

return ReactHotkeys;
}(_react["default"].Component);
}(React.Component);
exports["default"] = ReactHotkeys;
ReactHotkeys.defaultProps = {

@@ -129,3 +101,4 @@ filter: function filter(event) {

onKeyUp: PropTypes.func
};
};
export { ReactHotkeys as default };
//# sourceMappingURL=index.js.map
{
"name": "react-hot-keys",
"version": "2.0.0-beta.1",
"version": "2.0.0-beta.2",
"description": "React component to listen to keydown and keyup keyboard events, defining and dispatching keyboard shortcuts.",

@@ -56,3 +56,3 @@ "author": "kenny wang <wowohoo@qq.com>",

"enzyme-adapter-react-16": "^1.14.0",
"kkt": "^4.0.0",
"kkt": "^4.1.2",
"less": "^3.9.0",

@@ -63,3 +63,3 @@ "parcel-bundler": "^1.12.3",

"react-test-renderer": "^16.8.6",
"tsbb": "^1.0.3"
"tsbb": "^1.0.6"
},

@@ -66,0 +66,0 @@ "dependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc