react-hotkeys-hook
Advanced tools
Comparing version 3.3.3 to 3.4.0
import { useIsHotkeyPressed } from './useIsHotkeyPressed'; | ||
import { useHotkeys, Options } from './useHotkeys'; | ||
export { useHotkeys, useIsHotkeyPressed, Options }; | ||
declare const isHotkeyPressed: { | ||
(keyCode: number): boolean; | ||
(keyCode: string): boolean; | ||
}; | ||
export { useHotkeys, useIsHotkeyPressed, isHotkeyPressed, Options }; |
@@ -8,2 +8,6 @@ 'use strict'; | ||
/** | ||
* @deprecated Use isHotkeyPressed instead. Will be removed version 4. | ||
*/ | ||
function useIsHotkeyPressed() { | ||
@@ -78,3 +82,3 @@ return hotkeys.isPressed; | ||
return function () { | ||
hotkeys.unbind(keys, memoisedCallback); | ||
return hotkeys.unbind(keys, memoisedCallback); | ||
}; | ||
@@ -85,4 +89,7 @@ }, [memoisedCallback, keys, enabled]); | ||
var isHotkeyPressed = hotkeys.isPressed; | ||
exports.isHotkeyPressed = isHotkeyPressed; | ||
exports.useHotkeys = useHotkeys; | ||
exports.useIsHotkeyPressed = useIsHotkeyPressed; | ||
//# sourceMappingURL=react-hotkeys-hook.cjs.development.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";var e,t=(e=require("hotkeys-js"))&&"object"==typeof e&&"default"in e?e.default:e,n=require("react");t.filter=function(){return!0};var r=function(e,t){var n=e.target,r=n&&n.tagName;return Boolean(r&&t&&t.includes(r))};exports.useHotkeys=function(e,u,i,o){i instanceof Array&&(o=i,i=void 0);var a=i||{},l=a.enableOnTags,s=a.filter,c=a.keyup,f=a.keydown,d=a.filterPreventDefault,v=void 0===d||d,b=a.enabled,y=void 0===b||b,E=a.enableOnContentEditable,k=void 0!==E&&E,T=n.useRef(null),g=n.useCallback((function(e,t){var n;return s&&!s(e)?!v:!!(r(e,["INPUT","TEXTAREA","SELECT"])&&!r(e,l)||null!=(n=e.target)&&n.isContentEditable&&!k)||(null===T.current||document.activeElement===T.current)&&(u(e,t),!0)}),o?[T,l,s].concat(o):[T,l,s]);return n.useEffect((function(){if(y)return c&&!0!==f&&(i.keydown=!1),t(e,i||{},g),function(){t.unbind(e,g)}}),[g,e,y]),T},exports.useIsHotkeyPressed=function(){return t.isPressed}; | ||
"use strict";var e,t=(e=require("hotkeys-js"))&&"object"==typeof e&&"default"in e?e.default:e,n=require("react");t.filter=function(){return!0};var r=function(e,t){var n=e.target,r=n&&n.tagName;return Boolean(r&&t&&t.includes(r))};exports.isHotkeyPressed=t.isPressed,exports.useHotkeys=function(e,u,i,o){i instanceof Array&&(o=i,i=void 0);var s=i||{},a=s.enableOnTags,l=s.filter,c=s.keyup,f=s.keydown,d=s.filterPreventDefault,v=void 0===d||d,y=s.enabled,b=void 0===y||y,k=s.enableOnContentEditable,E=void 0!==k&&k,P=n.useRef(null),p=n.useCallback((function(e,t){var n;return l&&!l(e)?!v:!!(r(e,["INPUT","TEXTAREA","SELECT"])&&!r(e,a)||null!=(n=e.target)&&n.isContentEditable&&!E)||(null===P.current||document.activeElement===P.current)&&(u(e,t),!0)}),o?[P,a,l].concat(o):[P,a,l]);return n.useEffect((function(){if(b)return c&&!0!==f&&(i.keydown=!1),t(e,i||{},p),function(){return t.unbind(e,p)}}),[p,e,b]),P},exports.useIsHotkeyPressed=function(){return t.isPressed}; | ||
//# sourceMappingURL=react-hotkeys-hook.cjs.production.min.js.map |
import hotkeys from 'hotkeys-js'; | ||
import { useRef, useCallback, useEffect } from 'react'; | ||
/** | ||
* @deprecated Use isHotkeyPressed instead. Will be removed version 4. | ||
*/ | ||
function useIsHotkeyPressed() { | ||
@@ -73,3 +77,3 @@ return hotkeys.isPressed; | ||
return function () { | ||
hotkeys.unbind(keys, memoisedCallback); | ||
return hotkeys.unbind(keys, memoisedCallback); | ||
}; | ||
@@ -80,3 +84,5 @@ }, [memoisedCallback, keys, enabled]); | ||
export { useHotkeys, useIsHotkeyPressed }; | ||
var isHotkeyPressed = hotkeys.isPressed; | ||
export { isHotkeyPressed, useHotkeys, useIsHotkeyPressed }; | ||
//# sourceMappingURL=react-hotkeys-hook.esm.js.map |
@@ -0,1 +1,4 @@ | ||
/** | ||
* @deprecated Use isHotkeyPressed instead. Will be removed version 4. | ||
*/ | ||
export declare function useIsHotkeyPressed(): { | ||
@@ -2,0 +5,0 @@ (keyCode: number): boolean; |
{ | ||
"name": "react-hotkeys-hook", | ||
"version": "3.3.3", | ||
"version": "3.4.0", | ||
"repository": "https://JohannesKlauss@github.com/JohannesKlauss/react-keymap-hook.git", | ||
@@ -5,0 +5,0 @@ "homepage": "https://johannesklauss.github.io/react-hotkeys-hook/", |
import { useIsHotkeyPressed } from './useIsHotkeyPressed'; | ||
import { useHotkeys, Options } from './useHotkeys'; | ||
import hotkeys from 'hotkeys-js'; | ||
export { useHotkeys, useIsHotkeyPressed, Options }; | ||
const isHotkeyPressed = hotkeys.isPressed; | ||
export { useHotkeys, useIsHotkeyPressed, isHotkeyPressed, Options }; |
import hotkeys from 'hotkeys-js'; | ||
/** | ||
* @deprecated Use isHotkeyPressed instead. Will be removed version 4. | ||
*/ | ||
export function useIsHotkeyPressed() { | ||
return hotkeys.isPressed; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49354
407