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

react-hotkeys-hook

Package Overview
Dependencies
Maintainers
1
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-hotkeys-hook - npm Package Compare versions

Comparing version 1.5.1 to 1.5.2

dist-node/index.js.map

4

CHANGELOG.md

@@ -0,1 +1,5 @@

## [1.5.2] - 24-Aug-2019
* Update readme.
* Bump hotkeys version to 3.7.1
## [1.5.1] - 21-Jul-2019

@@ -2,0 +6,0 @@ * Update readme.

@@ -19,1 +19,2 @@ 'use strict';

exports.useHotkeys = useHotkeys;
//# sourceMappingURL=index.js.map

14

dist-web/index.js
import hotkeys from 'hotkeys-js';
import { useCallback, useEffect } from 'react';
function useHotkeys(keys, callback) {
let deps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
const memoisedCallback = useCallback(callback, deps);
useEffect(() => {
hotkeys(keys, memoisedCallback);
return () => hotkeys.unbind(keys);
}, [memoisedCallback]);
function useHotkeys(keys, callback, deps = []) {
const memoisedCallback = useCallback(callback, deps);
useEffect(() => {
hotkeys(keys, memoisedCallback);
return () => hotkeys.unbind(keys);
}, [memoisedCallback]);
}
export { useHotkeys };
//# sourceMappingURL=index.js.map
{
"name": "react-hotkeys-hook",
"version": "1.5.1",
"version": "1.5.2",
"license": "MIT",

@@ -25,3 +25,3 @@ "files": [

"dependencies": {
"hotkeys-js": "3.6.12"
"hotkeys-js": "3.7.1"
},

@@ -36,15 +36,15 @@ "peerDependencies": {

"@babel/preset-typescript": "7.3.3",
"@emotion/core": "10.0.14",
"@pika/pack": "0.4.0",
"@pika/plugin-build-node": "0.4.0",
"@pika/plugin-build-types": "0.4.0",
"@pika/plugin-build-web": "0.4.0",
"@pika/plugin-ts-standard-pkg": "0.4.0",
"@types/react": "16.8.23",
"@types/react-dom": "16.8.4",
"@emotion/core": "10.0.16",
"@pika/pack": "0.5.0",
"@pika/plugin-build-node": "0.6.0",
"@pika/plugin-build-types": "0.6.0",
"@pika/plugin-build-web": "0.6.0",
"@pika/plugin-ts-standard-pkg": "0.6.0",
"@types/react": "16.9.2",
"@types/react-dom": "16.9.0",
"docz": "1.2.0",
"docz-theme-default": "1.2.0",
"emotion-theming": "10.0.14",
"react": "16.8.6",
"react-dom": "16.8.6",
"react": "16.9.0",
"react-dom": "16.9.0",
"typescript": "3.5.3"

@@ -51,0 +51,0 @@ },

@@ -26,3 +26,5 @@ # react-hotkeys-hook

```typescript jsx
export const ExampleComponent: React.FunctionComponent<{}> = () => {
import { useHotkeys } from 'react-hotkeys-hook';
export const ExampleComponent: React.FC = () => {
const [count, setCount] = useState(0);

@@ -85,2 +87,9 @@ useHotkeys('ctrl+k', () => setCount(prevCount => prevCount + 1));

### Local Development
Checkout this repo, run `yarn` or `npm i` and then run the `docz:dev` script.
You can use the `docs/useHotkeys.mdx` to test the behavior of the hook. It directly imports the
`src/index.ts` file and transpiles it automatically. So you don't have to worry about. For more info
on .mdx files, check out the docz documentation: https://www.docz.site/docs/writing-mdx
### Authors

@@ -87,0 +96,0 @@

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