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

@react-hook/window-size

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-hook/window-size - npm Package Compare versions

Comparing version 3.0.3 to 3.0.4

6

dist/main/index.js
"use strict";
exports.__esModule = true;
exports.useWindowWidth = exports.useWindowHeight = exports.useWindowSize = void 0;
exports.default = exports.useWindowWidth = exports.useWindowHeight = exports.useWindowSize = void 0;

@@ -43,2 +43,4 @@ var _debounce = /*#__PURE__*/require("@react-hook/debounce");

exports.useWindowWidth = useWindowWidth;
exports.useWindowWidth = useWindowWidth;
var _default = useWindowSize;
exports.default = _default;

@@ -26,2 +26,3 @@ import { useDebounce } from '@react-hook/debounce';

export const useWindowHeight = options => useWindowSize(options)[1];
export const useWindowWidth = options => useWindowSize(options)[0];
export const useWindowWidth = options => useWindowSize(options)[0];
export default useWindowSize;

@@ -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.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.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})}));
//# sourceMappingURL=use-window-size.js.map
{
"name": "@react-hook/window-size",
"version": "3.0.3",
"version": "3.0.4",
"homepage": "https://github.com/jaredLunde/react-hook/tree/master/packages/window-size#readme",

@@ -5,0 +5,0 @@ "repository": "github:jaredLunde/react-hook",

"use strict";
exports.__esModule = true;
exports.useWindowWidth = exports.useWindowHeight = exports.useWindowSize = void 0;
exports.default = exports.useWindowWidth = exports.useWindowHeight = exports.useWindowSize = void 0;

@@ -44,2 +44,4 @@ var _throttle = /*#__PURE__*/require("@react-hook/throttle");

exports.useWindowWidth = useWindowWidth;
exports.useWindowWidth = useWindowWidth;
var _default = useWindowSize;
exports.default = _default;

@@ -27,2 +27,3 @@ /* eslint-disable import/no-extraneous-dependencies */

export const useWindowHeight = options => useWindowSize(options)[1];
export const useWindowWidth = options => useWindowSize(options)[0];
export const useWindowWidth = options => useWindowSize(options)[0];
export default useWindowSize;

@@ -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,t,r){function u(){d.current=0,s()}void 0===t&&(t=30),void 0===r&&(r=0);var o=i(e),f=1e3/t,d=n.useRef(0),a=n.useRef(),s=function(){return a.current&&clearTimeout(a.current)},l=[t,r,o];return n.useEffect((function(){return u}),l),n.useCallback((function(){var e=arguments,n=c(),t=function(){d.current=n,s(),o.current.apply(null,e)},u=d.current;if(r&&0===u)return t();if(n-u>f){if(u>0)return t();d.current=n}s(),a.current=setTimeout((function(){t(),d.current=0}),f)}),l)}function r(e,n,t,r){function o(){for(var e=arguments.length,n=new Array(e),t=0;e>t;t++)n[t]=arguments[t];c.current.apply(this,n)}void 0===r&&(r=u);var c=i(t),d=i(r);f((function(){var t=e&&"current"in e?e.current:e;if(t){var r=o;t.addEventListener(n,r);var u=d.current;return function(){t.removeEventListener(n,r),u()}}}),[e,n])}function u(){}var i=function(e){var t=n.useRef(e);return t.current=e,t},o="undefined"!=typeof performance?performance:Date,c=function(){return o.now()},f=n["undefined"!=typeof document&&void 0!==document.createElement?"useLayoutEffect":"useEffect"],d={},a="undefined"==typeof window?null:window,s=function(){return[document.documentElement.clientWidth,document.documentElement.clientHeight]},l=function(e){void 0===e&&(e=d);var u=e,i=u.fps,o=u.leading,c=u.initialWidth,f=void 0===c?0:c,l=u.initialHeight,v=function(e,r,u){var i=n.useState(e);return[i[0],t(i[1],r,u)]}("undefined"==typeof document?[f,void 0===l?0:l]:s,i,o),p=v[0],m=v[1],y=function(){return m(s)};return r(a,"resize",y),r(a,"orientationchange",y),p};e.useWindowHeight=function(e){return l(e)[1]},e.useWindowSize=l,e.useWindowWidth=function(e){return l(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,t,r){function u(){d.current=0,s()}void 0===t&&(t=30),void 0===r&&(r=0);var o=i(e),f=1e3/t,d=n.useRef(0),a=n.useRef(),s=function(){return a.current&&clearTimeout(a.current)},l=[t,r,o];return n.useEffect((function(){return u}),l),n.useCallback((function(){var e=arguments,n=c(),t=function(){d.current=n,s(),o.current.apply(null,e)},u=d.current;if(r&&0===u)return t();if(n-u>f){if(u>0)return t();d.current=n}s(),a.current=setTimeout((function(){t(),d.current=0}),f)}),l)}function r(e,n,t,r){function o(){for(var e=arguments.length,n=new Array(e),t=0;e>t;t++)n[t]=arguments[t];c.current.apply(this,n)}void 0===r&&(r=u);var c=i(t),d=i(r);f((function(){var t=e&&"current"in e?e.current:e;if(t){var r=o;t.addEventListener(n,r);var u=d.current;return function(){t.removeEventListener(n,r),u()}}}),[e,n])}function u(){}var i=function(e){var t=n.useRef(e);return t.current=e,t},o="undefined"!=typeof performance?performance:Date,c=function(){return o.now()},f=n["undefined"!=typeof document&&void 0!==document.createElement?"useLayoutEffect":"useEffect"],d={},a="undefined"==typeof window?null:window,s=function(){return[document.documentElement.clientWidth,document.documentElement.clientHeight]},l=function(e){void 0===e&&(e=d);var u=e,i=u.fps,o=u.leading,c=u.initialWidth,f=void 0===c?0:c,l=u.initialHeight,v=function(e,r,u){var i=n.useState(e);return[i[0],t(i[1],r,u)]}("undefined"==typeof document?[f,void 0===l?0:l]:s,i,o),p=v[0],m=v[1],y=function(){return m(s)};return r(a,"resize",y),r(a,"orientationchange",y),p};e.default=l,e.useWindowHeight=function(e){return l(e)[1]},e.useWindowSize=l,e.useWindowWidth=function(e){return l(e)[0]},Object.defineProperty(e,"__esModule",{value:1})}));
//# sourceMappingURL=use-window-size.js.map

@@ -20,1 +20,2 @@ export interface DebouncedWindowSizeOptions {

) => number
export default useWindowSize

@@ -20,1 +20,2 @@ export interface ThrottledWindowSizeOptions {

) => number
export default useWindowSize

@@ -20,1 +20,2 @@ export interface DebouncedWindowSizeOptions {

) => number
export default useWindowSize

@@ -20,1 +20,2 @@ export interface ThrottledWindowSizeOptions {

) => 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

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

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