@react-hook/window-size
Advanced tools
Comparing version 2.2.0 to 3.0.0
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = exports.useWindowWidth = exports.useWindowHeight = exports.useWindowSize = void 0; | ||
exports.useWindowWidth = exports.useWindowHeight = exports.useWindowSize = void 0; | ||
@@ -43,4 +43,2 @@ var _debounce = /*#__PURE__*/require("@react-hook/debounce"); | ||
exports.useWindowWidth = useWindowWidth; | ||
var _default = useWindowSize; | ||
exports.default = _default; | ||
exports.useWindowWidth = useWindowWidth; |
@@ -26,3 +26,2 @@ import { useDebounce } from '@react-hook/debounce'; | ||
export const useWindowHeight = options => useWindowSize(options)[1]; | ||
export const useWindowWidth = options => useWindowSize(options)[0]; | ||
export default useWindowSize; | ||
export const useWindowWidth = options => useWindowSize(options)[0]; |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],n):n((e=e||self).UseWindowSize={},e.React)}(this,(function(e,n){"use strict";function t(e,n,t,i){function c(){for(var e=arguments.length,n=new Array(e),t=0;e>t;t++)n[t]=arguments[t];f.current.apply(this,n)}void 0===i&&(i=r);var f=u(t),d=u(i);o((function(){var t=e&&"current"in e?e.current:e;if(t){var r=c;t.addEventListener(n,r);var u=d.current;return function(){t.removeEventListener(n,r),u()}}}),[e,n])}function r(){}var u=function(e){var t=n.useRef(e);return t.current=e,t},i=function(e,t,r){function i(){f.current&&clearTimeout(f.current),f.current=void 0}function o(){f.current=void 0}void 0===t&&(t=100),void 0===r&&(r=0);var c=u(e),f=n.useRef(),d=[t,r,c];return n.useEffect((function(){return i}),d),n.useCallback((function(){var e=arguments,n=f.current;if(void 0===n&&r)return f.current=setTimeout(o,t),c.current.apply(null,e);n&&clearTimeout(n),f.current=setTimeout((function(){f.current=void 0,c.current.apply(null,e)}),t)}),d)},o=n["undefined"!=typeof document&&void 0!==document.createElement?"useLayoutEffect":"useEffect"],c={},f="undefined"==typeof window?null:window,d=function(){return[document.documentElement.clientWidth,document.documentElement.clientHeight]},a=function(e){void 0===e&&(e=c);var r=e,u=r.wait,o=r.leading,a=r.initialWidth,l=void 0===a?0:a,v=r.initialHeight,s=function(e,t,r){var u=n.useState(e);return[u[0],i(u[1],t,r)]}("undefined"==typeof document?[l,void 0===v?0:v]:d,u,o),m=s[0],p=s[1],y=function(){return p(d)};return t(f,"resize",y),t(f,"orientationchange",y),m};e.default=a,e.useWindowHeight=function(e){return a(e)[1]},e.useWindowSize=a,e.useWindowWidth=function(e){return a(e)[0]},Object.defineProperty(e,"__esModule",{value:1})})); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],n):n((e=e||self).UseWindowSize={},e.React)}(this,(function(e,n){"use strict";function t(e,n,t,i){function c(){for(var e=arguments.length,n=new Array(e),t=0;e>t;t++)n[t]=arguments[t];f.current.apply(this,n)}void 0===i&&(i=r);var f=u(t),d=u(i);o((function(){var t=e&&"current"in e?e.current:e;if(t){var r=c;t.addEventListener(n,r);var u=d.current;return function(){t.removeEventListener(n,r),u()}}}),[e,n])}function r(){}var u=function(e){var t=n.useRef(e);return t.current=e,t},i=function(e,t,r){function i(){f.current&&clearTimeout(f.current),f.current=void 0}function o(){f.current=void 0}void 0===t&&(t=100),void 0===r&&(r=0);var c=u(e),f=n.useRef(),d=[t,r,c];return n.useEffect((function(){return i}),d),n.useCallback((function(){var e=arguments,n=f.current;if(void 0===n&&r)return f.current=setTimeout(o,t),c.current.apply(null,e);n&&clearTimeout(n),f.current=setTimeout((function(){f.current=void 0,c.current.apply(null,e)}),t)}),d)},o=n["undefined"!=typeof document&&void 0!==document.createElement?"useLayoutEffect":"useEffect"],c={},f="undefined"==typeof window?null:window,d=function(){return[document.documentElement.clientWidth,document.documentElement.clientHeight]},a=function(e){void 0===e&&(e=c);var r=e,u=r.wait,o=r.leading,a=r.initialWidth,l=void 0===a?0:a,v=r.initialHeight,s=function(e,t,r){var u=n.useState(e);return[u[0],i(u[1],t,r)]}("undefined"==typeof document?[l,void 0===v?0:v]:d,u,o),m=s[0],p=s[1],y=function(){return p(d)};return t(f,"resize",y),t(f,"orientationchange",y),m};e.useWindowHeight=function(e){return a(e)[1]},e.useWindowSize=a,e.useWindowWidth=function(e){return a(e)[0]},Object.defineProperty(e,"__esModule",{value:1})})); | ||
//# sourceMappingURL=use-window-size.js.map |
{ | ||
"name": "@react-hook/window-size", | ||
"version": "2.2.0", | ||
"version": "3.0.0", | ||
"homepage": "https://github.com/jaredLunde/react-hook/tree/master/packages/window-size#readme", | ||
@@ -73,3 +73,3 @@ "repository": "github:jaredLunde/react-hook", | ||
"dev": "lundle build -f module,cjs -w", | ||
"format": "prettier --write \"{,!(node_modules|dist|coverage)/**/}*.{ts,tsx,js,jsx,md,yml,json}\"", | ||
"format": "prettier --write \"{,!(node_modules|dist|coverage|throttled)/**/}*.{ts,tsx,js,jsx,md,yml,json}\" && prettier --write \"throttled/{,!(node_modules|dist|coverage)/**/}*.{ts,tsx,js,jsx,md,yml,json}\"", | ||
"lint": "eslint . --ext .ts,.tsx", | ||
@@ -100,3 +100,4 @@ "prepublishOnly": "npm run lint && npm run test && npm run build && npm run format", | ||
"rules": { | ||
"testing-library/prefer-wait-for": "off" | ||
"testing-library/prefer-wait-for": "off", | ||
"import/no-extraneous-dependencies": "warn" | ||
}, | ||
@@ -103,0 +104,0 @@ "settings": { |
@@ -20,2 +20,1 @@ export interface DebouncedWindowSizeOptions { | ||
) => number | ||
export default useWindowSize |
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
41410
230