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

react-resize-detector

Package Overview
Dependencies
Maintainers
1
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-resize-detector - npm Package Compare versions

Comparing version 3.1.1 to 3.1.2

26

lib/index.js

@@ -88,3 +88,3 @@ 'use strict';

_this.createResizeObserver = function (entries) {
_this.createResizeHandler = function (entries) {
var _this$props = _this.props,

@@ -102,5 +102,7 @@ handleWidth = _this$props.handleWidth,

var notifyHeight = handleHeight && _this.state.height !== height;
if (!_this.skipOnMount && (notifyWidth || notifyHeight)) {
onResize(width, height);
_this.setState({ width: width, height: height });
if (!_this.skipOnMount && (notifyWidth || notifyHeight) && typeof window !== 'undefined') {
_this.animationFrameID = window.requestAnimationFrame(function () {
onResize(width, height);
_this.setState({ width: width, height: height });
});
}

@@ -144,4 +146,2 @@ _this.skipOnMount = false;

_this.skipOnMount = skipOnMount;
_this.state = {

@@ -152,5 +152,8 @@ width: undefined,

var resizeObserver = listMode[refreshMode] && listMode[refreshMode](_this.createResizeObserver, refreshRate) || _this.createResizeObserver;
_this.skipOnMount = skipOnMount;
_this.animationFrameID = null;
_this.ro = new _resizeObserverPolyfill2.default(resizeObserver);
_this.resizeHandler = listMode[refreshMode] && listMode[refreshMode](_this.createResizeHandler, refreshRate) || _this.createResizeHandler;
_this.ro = new _resizeObserverPolyfill2.default(_this.resizeHandler);
return _this;

@@ -170,2 +173,9 @@ }

if (resizableElement) this.ro.unobserve(resizableElement);
if (typeof window !== 'undefined' && this.animationFrameID) {
window.cancelAnimationFrame(this.animationFrameID);
}
if (this.resizeHandler && this.resizeHandler.cancel) {
// cancel debounced handler
this.resizeHandler.cancel();
}
}

@@ -172,0 +182,0 @@ }, {

{
"author": "Vitalii Maslianok <maslianok@gmail.com> (https://github.com/maslianok)",
"version": "3.1.1",
"version": "3.1.2",
"bugs": {

@@ -5,0 +5,0 @@ "url": "https://github.com/maslianok/react-resize-detector/issues"

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