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 1.0.12 to 1.0.13

10

dist/cjs/index.d.ts

@@ -5,2 +5,7 @@ export interface DebounceOptions {

}
export declare const useWindowSize: (
initialWidth?: number | undefined,
initialHeight?: number | undefined,
options?: DebounceOptions
) => [number, number]
export declare const useWindowHeight: (

@@ -14,7 +19,2 @@ initialValue?: number,

) => number
export declare const useWindowSize: (
initialWidth?: number | undefined,
initialHeight?: number | undefined,
options?: DebounceOptions | undefined
) => [number, number]
export default useWindowSize
'use strict'
exports.__esModule = true
exports.default = exports.useWindowSize = exports.useWindowWidth = exports.useWindowHeight = void 0
exports.default = exports.useWindowWidth = exports.useWindowHeight = exports.useWindowSize = void 0

@@ -18,8 +18,12 @@ var _react = _interopRequireDefault(require('react'))

const useSizeHook = (dim, initialValue, options = emptyObj) => {
const useWindowSize = (initialWidth, initialHeight, options = emptyObj) => {
const {wait, leading} = options
const [size, setDebouncedSize] = (0, _debounce.default)(
/* istanbul ignore next */
typeof document === 'undefined'
? initialValue
: document.documentElement[dim],
? [initialWidth, initialHeight]
: [
document.documentElement.clientWidth,
document.documentElement.clientHeight,
],
wait,

@@ -30,3 +34,6 @@ leading

function _ref() {
return setDebouncedSize(document.documentElement[dim])
return setDebouncedSize([
document.documentElement.clientWidth,
document.documentElement.clientHeight,
])
}

@@ -46,4 +53,6 @@

exports.useWindowSize = useWindowSize
const useWindowHeight = (initialValue = 0, options) =>
useSizeHook('clientHeight', initialValue, options)
useWindowSize(0, initialValue, options)[1]

@@ -53,13 +62,6 @@ exports.useWindowHeight = useWindowHeight

const useWindowWidth = (initialValue = 0, options) =>
useSizeHook('clientWidth', initialValue, options)
useWindowSize(initialValue, 0, options)[0]
exports.useWindowWidth = useWindowWidth
const useWindowSize = (initialWidth, initialHeight, options) => [
useWindowWidth(initialWidth, options),
useWindowHeight(initialHeight, options),
]
exports.useWindowSize = useWindowSize
var _default = useWindowSize
exports.default = _default

@@ -5,2 +5,7 @@ export interface DebounceOptions {

}
export declare const useWindowSize: (
initialWidth?: number | undefined,
initialHeight?: number | undefined,
options?: DebounceOptions
) => [number, number]
export declare const useWindowHeight: (

@@ -14,7 +19,2 @@ initialValue?: number,

) => number
export declare const useWindowSize: (
initialWidth?: number | undefined,
initialHeight?: number | undefined,
options?: DebounceOptions | undefined
) => [number, number]
export default useWindowSize

@@ -6,9 +6,16 @@ import React from 'react'

const emptyObj = {}
const useSizeHook = (dim, initialValue, options = emptyObj) => {
export const useWindowSize = (
initialWidth,
initialHeight,
options = emptyObj
) => {
const {wait, leading} = options
const [size, setDebouncedSize] = useDebounce(
/* istanbul ignore next */
typeof document === 'undefined'
? initialValue
: document.documentElement[dim],
? [initialWidth, initialHeight]
: [
document.documentElement.clientWidth,
document.documentElement.clientHeight,
],
wait,

@@ -19,3 +26,6 @@ leading

function _ref() {
return setDebouncedSize(document.documentElement[dim])
return setDebouncedSize([
document.documentElement.clientWidth,
document.documentElement.clientHeight,
])
}

@@ -34,11 +44,6 @@

}
export const useWindowHeight = (initialValue = 0, options) =>
useSizeHook('clientHeight', initialValue, options)
useWindowSize(0, initialValue, options)[1]
export const useWindowWidth = (initialValue = 0, options) =>
useSizeHook('clientWidth', initialValue, options)
export const useWindowSize = (initialWidth, initialHeight, options) => [
useWindowWidth(initialWidth, options),
useWindowHeight(initialHeight, options),
]
useWindowSize(initialValue, 0, options)[0]
export default useWindowSize
{
"name": "@react-hook/window-size",
"version": "1.0.12",
"version": "1.0.13",
"homepage": "https://github.com/jaredLunde/react-hook#readme",

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

@@ -5,2 +5,11 @@ export interface ThrottleOptions {

}
export interface ThrottleOptions {
wait?: number
leading?: boolean
}
export declare const useWindowSize: (
initialWidth?: number | undefined,
initialHeight?: number | undefined,
options?: ThrottleOptions
) => [number, number]
export declare const useWindowHeight: (

@@ -14,7 +23,2 @@ initialValue?: number,

) => number
export declare const useWindowSize: (
initialWidth?: number | undefined,
initialHeight?: number | undefined,
options?: ThrottleOptions | undefined
) => [number, number]
export default useWindowSize
'use strict'
exports.__esModule = true
exports.default = exports.useWindowSize = exports.useWindowWidth = exports.useWindowHeight = void 0
exports.default = exports.useWindowWidth = exports.useWindowHeight = exports.useWindowSize = void 0

@@ -18,8 +18,12 @@ var _react = _interopRequireDefault(require('react'))

const useSizeHook = (dim, initialValue, options = emptyObj) => {
const useWindowSize = (initialWidth, initialHeight, options = emptyObj) => {
const {fps, leading} = options
const [size, setThrottledSize] = (0, _throttle.default)(
/* istanbul ignore next */
typeof document === 'undefined'
? initialValue
: document.documentElement[dim],
? [initialWidth, initialHeight]
: [
document.documentElement.clientWidth,
document.documentElement.clientHeight,
],
fps,

@@ -30,3 +34,6 @@ leading

function _ref() {
return setThrottledSize(document.documentElement[dim])
return setThrottledSize([
document.documentElement.clientWidth,
document.documentElement.clientHeight,
])
}

@@ -46,4 +53,6 @@

exports.useWindowSize = useWindowSize
const useWindowHeight = (initialValue = 0, options) =>
useSizeHook('clientHeight', initialValue, options)
useWindowSize(0, initialValue, options)[1]

@@ -53,13 +62,6 @@ exports.useWindowHeight = useWindowHeight

const useWindowWidth = (initialValue = 0, options) =>
useSizeHook('clientWidth', initialValue, options)
useWindowSize(initialValue, 0, options)[0]
exports.useWindowWidth = useWindowWidth
const useWindowSize = (initialWidth, initialHeight, options) => [
useWindowWidth(initialWidth, options),
useWindowHeight(initialHeight, options),
]
exports.useWindowSize = useWindowSize
var _default = useWindowSize
exports.default = _default
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