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

hook-book

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hook-book - npm Package Compare versions

Comparing version 0.0.1-beta.16 to 0.0.1-beta.17

2

package.json
{
"name": "hook-book",
"version": "0.0.1-beta.16",
"version": "0.0.1-beta.17",
"description": "A collection of custom React Hooks",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -5,3 +5,3 @@ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=useKeyPress;var _react=require("react");var _reducer=_interopRequireWildcard(require("./reducer"));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 _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function useKeyPress(){// Use the useReducer hook instead of useState, since the resulting states

// event never fires & remain 'active' when the window regains focus
var onBlur=function onBlur(){return dispatch({type:"RESET"})};(0,_react.useEffect)(function(){document.addEventListener("keydown",onKeyDown);document.addEventListener("keyup",onKeyUp);window.addEventListener("blur",onBlur);return function(){document.removeEventListener("keydown",onKeyDown);document.removeEventListener("keyup",onKeyUp);window.removeEventListener("blur",onBlur)}});return keyPressed}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3JlY2lwZXMvdXNlLWtleXByZXNzL2luZGV4LmpzIl0sIm5hbWVzIjpbInVzZUtleVByZXNzIiwicmVkdWNlciIsImluaXRpYWxTdGF0ZSIsImtleVByZXNzZWQiLCJkaXNwYXRjaCIsIm9uS2V5RG93biIsImV2ZW50IiwidHlwZSIsImtleSIsIm9uS2V5VXAiLCJvbkJsdXIiLCJkb2N1bWVudCIsImFkZEV2ZW50TGlzdGVuZXIiLCJ3aW5kb3ciLCJyZW1vdmVFdmVudExpc3RlbmVyIl0sIm1hcHBpbmdzIjoia0dBQUEsNEJBQ0EsMkQsMC9CQUVlLFFBQVNBLENBQUFBLFdBQVQsRUFBdUIsQ0FDbEM7QUFDQTtBQUZrQyxnQkFHSCxzQkFBV0MsZ0JBQVgsQ0FBb0JDLHFCQUFwQixDQUhHLDRDQUczQkMsVUFIMkIsaUJBR2ZDLFFBSGUsaUJBS2xDLEdBQU1DLENBQUFBLFNBQVMsQ0FBRyxRQUFaQSxDQUFBQSxTQUFZLENBQUFDLEtBQUssUUFBSUYsQ0FBQUEsUUFBUSxDQUFDLENBQUNHLElBQUksQ0FBRSxVQUFQLENBQW1CQyxHQUFHLENBQUVGLEtBQUssQ0FBQ0UsR0FBOUIsQ0FBRCxDQUFaLENBQXZCLENBQ0EsR0FBTUMsQ0FBQUEsT0FBTyxDQUFHLFFBQVZBLENBQUFBLE9BQVUsQ0FBQUgsS0FBSyxRQUFJRixDQUFBQSxRQUFRLENBQUMsQ0FBQ0csSUFBSSxDQUFFLFFBQVAsQ0FBaUJDLEdBQUcsQ0FBRUYsS0FBSyxDQUFDRSxHQUE1QixDQUFELENBQVosQ0FBckIsQ0FDQTtBQUNBO0FBQ0EsR0FBTUUsQ0FBQUEsT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ZlbnQgPT4gZGlzcGF0Y2goe3R5cGU6ICdLRVlfRE9XTicsIGtleTogZXZlbnQua2V5fSlcbiAgICBjb25zdCBvbktleVVwID0gZXZlbnQgPT4gZGlzcGF0Y2goe3R5cGU6ICdLRVlfVVAnLCBrZXk6IGV2ZW50LmtleX0pXG4gICAgLy8gTmVlZCB0byByZXNldCBhY3RpdmUga2V5cyB3aGVuIHRoZSB3aW5kb3cgbG9zZXMgZm9jdXMsIG90aGVyd2lzZSB0aGUga2V5dXBcbiAgICAvLyBldmVudCBuZXZlciBmaXJlcyAmIHJlbWFpbiAnYWN0aXZlJyB3aGVuIHRoZSB3aW5kb3cgcmVnYWlucyBmb2N1c1xuICAgIGNvbnN0IG9uQmx1ciA9ICgpID0+IGRpc3BhdGNoKHt0eXBlOiAnUkVTRVQnfSlcblxuICAgIHVzZUVmZmVjdCgoKSA9PiB7XG4gICAgICAgIGRvY3VtZW50LmFkZEV2ZW50TGlzdGVuZXIoJ2tleWRvd24nLCBvbktleURvd24pXG4gICAgICAgIGRvY3VtZW50LmFkZEV2ZW50TGlzdGVuZXIoJ2tleXVwJywgb25LZXlVcClcbiAgICAgICAgd2luZG93LmFkZEV2ZW50TGlzdGVuZXIoJ2JsdXInLCBvbkJsdXIpXG5cbiAgICAgICAgcmV0dXJuICgpID0+IHtcbiAgICAgICAgICAgIGRvY3VtZW50LnJlbW92ZUV2ZW50TGlzdGVuZXIoJ2tleWRvd24nLCBvbktleURvd24pXG4gICAgICAgICAgICBkb2N1bWVudC5yZW1vdmVFdmVudExpc3RlbmVyKCdrZXl1cCcsIG9uS2V5VXApXG4gICAgICAgICAgICB3aW5kb3cucmVtb3ZlRXZlbnRMaXN0ZW5lcignYmx1cicsIG9uQmx1cilcbiAgICAgICAgfVxuICAgIH0pXG5cbiAgICByZXR1cm4ga2V5UHJlc3NlZFxufVxuIl19
var onBlur=function onBlur(){return dispatch({type:"RESET"})};(0,_react.useEffect)(function(){document.addEventListener("keydown",onKeyDown);document.addEventListener("keyup",onKeyUp);window.addEventListener("blur",onBlur);return function(){document.removeEventListener("keydown",onKeyDown);document.removeEventListener("keyup",onKeyUp);window.removeEventListener("blur",onBlur)}},[]);return keyPressed}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3JlY2lwZXMvdXNlLWtleXByZXNzL2luZGV4LmpzIl0sIm5hbWVzIjpbInVzZUtleVByZXNzIiwicmVkdWNlciIsImluaXRpYWxTdGF0ZSIsImtleVByZXNzZWQiLCJkaXNwYXRjaCIsIm9uS2V5RG93biIsImV2ZW50IiwidHlwZSIsImtleSIsIm9uS2V5VXAiLCJvbkJsdXIiLCJkb2N1bWVudCIsImFkZEV2ZW50TGlzdGVuZXIiLCJ3aW5kb3ciLCJyZW1vdmVFdmVudExpc3RlbmVyIl0sIm1hcHBpbmdzIjoia0dBQUEsNEJBQ0EsMkQsMC9CQUVlLFFBQVNBLENBQUFBLFdBQVQsRUFBdUIsQ0FDbEM7QUFDQTtBQUZrQyxnQkFHSCxzQkFBV0MsZ0JBQVgsQ0FBb0JDLHFCQUFwQixDQUhHLDRDQUczQkMsVUFIMkIsaUJBR2ZDLFFBSGUsaUJBS2xDLEdBQU1DLENBQUFBLFNBQVMsQ0FBRyxRQUFaQSxDQUFBQSxTQUFZLENBQUFDLEtBQUssUUFBSUYsQ0FBQUEsUUFBUSxDQUFDLENBQUNHLElBQUksQ0FBRSxVQUFQLENBQW1CQyxHQUFHLENBQUVGLEtBQUssQ0FBQ0UsR0FBOUIsQ0FBRCxDQUFaLENBQXZCLENBQ0EsR0FBTUMsQ0FBQUEsT0FBTyxDQUFHLFFBQVZBLENBQUFBLE9BQVUsQ0FBQUgsS0FBSyxRQUFJRixDQUFBQSxRQUFRLENBQUMsQ0FBQ0csSUFBSSxDQUFFLFFBQVAsQ0FBaUJDLEdBQUcsQ0FBRUYsS0FBSyxDQUFDRSxHQUE1QixDQUFELENBQVosQ0FBckIsQ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ocket 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