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.2.0 to 1.3.0

4

CHANGELOG.md

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

## [1.3.0] - 06-Apr-2019
* Fixed bind and unbind on every render
* Updated docz to make it work with the new deps array
## [1.2.0] - 30-Mar-2019

@@ -2,0 +6,0 @@ * Updated hotkeys

9

dist-node/index.js

@@ -12,9 +12,14 @@ 'use strict';

react.useEffect(() => {
hotkeys(keys, (event, handler) => callback(event, handler));
console.log('calling bind');
hotkeys(keys, (event, handler) => {
console.log('callback gets called');
callback(event, handler);
});
return function () {
console.log('calling unbind');
hotkeys.unbind(keys);
};
});
}, []);
}
exports.useHotkeys = useHotkeys;

@@ -5,7 +5,12 @@ import hotkeys from 'hotkeys-js';

useEffect(() => {
hotkeys(keys, (event, handler) => callback(event, handler));
console.log('calling bind');
hotkeys(keys, (event, handler) => {
console.log('callback gets called');
callback(event, handler);
});
return function () {
console.log('calling unbind');
hotkeys.unbind(keys);
};
});
}, []);
}

@@ -6,9 +6,14 @@ import hotkeys from 'hotkeys-js';

useEffect(() => {
hotkeys(keys, (event, handler) => callback(event, handler));
console.log('calling bind');
hotkeys(keys, (event, handler) => {
console.log('callback gets called');
callback(event, handler);
});
return function () {
console.log('calling unbind');
hotkeys.unbind(keys);
};
});
}, []);
}
export { useHotkeys };
{
"name": "react-hotkeys-hook",
"description": "React hook for using keyboard shortcuts in components. This is a hook version for the [hotkeys] package.",
"version": "1.2.0",
"version": "1.3.0",
"license": "MIT",

@@ -37,7 +37,7 @@ "source": "dist-src/index.js",

"devDependencies": {
"@babel/core": "7.4.0",
"@babel/preset-env": "7.4.2",
"@babel/core": "7.4.3",
"@babel/preset-env": "7.4.3",
"@babel/preset-react": "7.0.0",
"@babel/preset-typescript": "7.3.3",
"@emotion/core": "10.0.6",
"@emotion/core": "10.0.10",
"@pika/pack": "0.3.6",

@@ -48,11 +48,11 @@ "@pika/plugin-build-node": "0.3.14",

"@pika/plugin-ts-standard-pkg": "0.3.14",
"@types/react": "16.8.10",
"@types/react": "16.8.12",
"@types/react-dom": "16.8.3",
"docz": "0.13.7",
"docz-theme-default": "0.13.7",
"emotion-theming": "10.0.6",
"emotion-theming": "10.0.10",
"react": "16.8.6",
"react-dom": "16.8.6",
"typescript": "3.4.1"
"typescript": "3.4.2"
}
}

@@ -28,3 +28,3 @@ # react-hotkeys-hook

const [count, setCount] = useState(0);
useHotkeys('ctrl+k', () => setCount(count + 1));
useHotkeys('ctrl+k', () => setCount(prevCount => prevCount + 1));

@@ -43,3 +43,3 @@ return (

const [count, setCount] = useState(0);
useHotkeys('ctrl+k', () => setCount(count + 1));
useHotkeys('ctrl+k', () => setCount(prevCount => prevCount + 1));

@@ -46,0 +46,0 @@ return (

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