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.4 to 1.6.0

5

dist-node/index.js

@@ -10,8 +10,9 @@ 'use strict';

function useHotkeys(keys, callback, deps = []) {
function useHotkeys(keys, callback, deps = [], options = {}) {
const memoisedCallback = react.useCallback(callback, deps);
react.useEffect(() => {
if (options.filter) hotkeys.filter = options.filter;
hotkeys(keys, memoisedCallback);
return () => hotkeys.unbind(keys, memoisedCallback);
}, [memoisedCallback]);
}, [memoisedCallback, options]);
}

@@ -18,0 +19,0 @@

8

dist-src/index.js

@@ -1,9 +0,11 @@

import hotkeys from 'hotkeys-js';
import hotkeys from "hotkeys-js";
import { useCallback, useEffect } from "react";
export function useHotkeys(keys, callback, deps = []) {
export function useHotkeys(keys, callback, deps = [], options = {}) {
const memoisedCallback = useCallback(callback, deps);
useEffect(() => {
if (options.filter)
hotkeys.filter = options.filter;
hotkeys(keys, memoisedCallback);
return () => hotkeys.unbind(keys, memoisedCallback);
}, [memoisedCallback]);
}, [memoisedCallback, options]);
}

@@ -1,4 +0,7 @@

import { HotkeysEvent } from 'hotkeys-js';
import hotkeys, { HotkeysEvent } from "hotkeys-js";
declare type CallbackFn = (event: KeyboardEvent, handler: HotkeysEvent) => void;
export declare function useHotkeys(keys: string, callback: CallbackFn, deps?: any[]): void;
declare type Options = {
filter?: typeof hotkeys.filter;
};
export declare function useHotkeys(keys: string, callback: CallbackFn, deps?: any[], options?: Options): void;
export {};
import hotkeys from 'hotkeys-js';
import { useCallback, useEffect } from 'react';
function useHotkeys(keys, callback, deps = []) {
function useHotkeys(keys, callback, deps = [], options = {}) {
const memoisedCallback = useCallback(callback, deps);
useEffect(() => {
if (options.filter)
hotkeys.filter = options.filter;
hotkeys(keys, memoisedCallback);
return () => hotkeys.unbind(keys, memoisedCallback);
}, [memoisedCallback]);
}, [memoisedCallback, options]);
}

@@ -11,0 +13,0 @@

{
"name": "react-hotkeys-hook",
"version": "1.5.4",
"version": "1.6.0",
"license": "MIT",

@@ -31,19 +31,19 @@ "files": [

"devDependencies": {
"@babel/core": "7.7.5",
"@babel/preset-env": "7.7.6",
"@babel/preset-react": "7.7.4",
"@babel/preset-typescript": "7.7.4",
"@emotion/core": "10.0.22",
"@babel/core": "7.8.7",
"@babel/preset-env": "7.8.7",
"@babel/preset-react": "7.8.3",
"@babel/preset-typescript": "7.8.3",
"@emotion/core": "10.0.28",
"@pika/pack": "0.5.0",
"@pika/plugin-build-node": "0.8.1",
"@pika/plugin-build-types": "0.8.1",
"@pika/plugin-build-web": "0.8.1",
"@pika/plugin-ts-standard-pkg": "0.8.1",
"@types/react": "16.9.15",
"@types/react-dom": "16.9.4",
"docz": "2.1.1",
"emotion-theming": "10.0.19",
"react": "16.12.0",
"react-dom": "16.12.0",
"typescript": "3.7.3"
"@pika/plugin-build-node": "0.9.2",
"@pika/plugin-build-types": "0.9.2",
"@pika/plugin-build-web": "0.9.2",
"@pika/plugin-ts-standard-pkg": "0.9.2",
"@types/react": "16.9.23",
"@types/react-dom": "16.9.5",
"docz": "2.2.0",
"emotion-theming": "10.0.27",
"react": "16.13.0",
"react-dom": "16.13.0",
"typescript": "3.8.3"
},

@@ -50,0 +50,0 @@ "source": "dist-src/index.js",

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