New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@react-hook/resize-observer

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-hook/resize-observer - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

42

dist/main/index.js

@@ -37,8 +37,2 @@ "use strict";

}, [target, resizeObserver, storedCallback]);
(0, _passiveLayoutEffect.default)(() => {
const targetEl = target && 'current' in target ? target.current : target;
if (!targetEl) return;
resizeObserver.observer.observe(targetEl);
return () => resizeObserver.observer.unobserve(targetEl);
}, [target, resizeObserver.observer]);
return resizeObserver.observer;

@@ -49,18 +43,28 @@ }

const callbacks = new Map();
const observer = new _resizeObserverPolyfill.default((entries, observer) => {
if (entries.length === 1) {
var _callbacks$get;
(_callbacks$get = callbacks.get(entries[0].target)) === null || _callbacks$get === void 0 ? void 0 : _callbacks$get(entries[0], observer);
} else {
for (let i = 0; i < entries.length; i++) {
var _callbacks$get2;
(_callbacks$get2 = callbacks.get(entries[i].target)) === null || _callbacks$get2 === void 0 ? void 0 : _callbacks$get2(entries[i], observer);
}
}
});
return {
observer: new _resizeObserverPolyfill.default((entries, observer) => {
if (entries.length === 1) {
var _callbacks$get;
observer,
(_callbacks$get = callbacks.get(entries[0].target)) === null || _callbacks$get === void 0 ? void 0 : _callbacks$get(entries[0], observer);
} else {
for (let i = 0; i < entries.length; i++) {
var _callbacks$get2;
subscribe(target, callback) {
observer.observe(target);
callbacks.set(target, callback);
},
(_callbacks$get2 = callbacks.get(entries[i].target)) === null || _callbacks$get2 === void 0 ? void 0 : _callbacks$get2(entries[i], observer);
}
}
}),
subscribe: (target, callback) => callbacks.set(target, callback),
unsubscribe: target => callbacks.delete(target)
unsubscribe(target) {
observer.unobserve(target);
callbacks.delete(target);
}
};

@@ -67,0 +71,0 @@ }

@@ -28,8 +28,2 @@ import ResizeObserver from 'resize-observer-polyfill';

}, [target, resizeObserver, storedCallback]);
useLayoutEffect(() => {
const targetEl = target && 'current' in target ? target.current : target;
if (!targetEl) return;
resizeObserver.observer.observe(targetEl);
return () => resizeObserver.observer.unobserve(targetEl);
}, [target, resizeObserver.observer]);
return resizeObserver.observer;

@@ -40,18 +34,28 @@ }

const callbacks = new Map();
const observer = new ResizeObserver((entries, observer) => {
if (entries.length === 1) {
var _callbacks$get;
(_callbacks$get = callbacks.get(entries[0].target)) === null || _callbacks$get === void 0 ? void 0 : _callbacks$get(entries[0], observer);
} else {
for (let i = 0; i < entries.length; i++) {
var _callbacks$get2;
(_callbacks$get2 = callbacks.get(entries[i].target)) === null || _callbacks$get2 === void 0 ? void 0 : _callbacks$get2(entries[i], observer);
}
}
});
return {
observer: new ResizeObserver((entries, observer) => {
if (entries.length === 1) {
var _callbacks$get;
observer,
(_callbacks$get = callbacks.get(entries[0].target)) === null || _callbacks$get === void 0 ? void 0 : _callbacks$get(entries[0], observer);
} else {
for (let i = 0; i < entries.length; i++) {
var _callbacks$get2;
subscribe(target, callback) {
observer.observe(target);
callbacks.set(target, callback);
},
(_callbacks$get2 = callbacks.get(entries[i].target)) === null || _callbacks$get2 === void 0 ? void 0 : _callbacks$get2(entries[i], observer);
}
}
}),
subscribe: (target, callback) => callbacks.set(target, callback),
unsubscribe: target => callbacks.delete(target)
unsubscribe(target) {
observer.unobserve(target);
callbacks.delete(target);
}
};

@@ -58,0 +62,0 @@ }

@@ -1198,10 +1198,2 @@ (function (global, factory) {

}, [target, resizeObserver, storedCallback]);
usePassiveLayoutEffect(function () {
var targetEl = target && 'current' in target ? target.current : target;
if (!targetEl) return;
resizeObserver.observer.observe(targetEl);
return function () {
return resizeObserver.observer.unobserve(targetEl);
};
}, [target, resizeObserver.observer]);
return resizeObserver.observer;

@@ -1212,21 +1204,24 @@ }

var callbacks = new Map();
return {
observer: new index(function (entries, observer) {
if (entries.length === 1) {
var _callbacks$get;
var observer = new index(function (entries, observer) {
if (entries.length === 1) {
var _callbacks$get;
(_callbacks$get = callbacks.get(entries[0].target)) === null || _callbacks$get === void 0 ? void 0 : _callbacks$get(entries[0], observer);
} else {
for (var i = 0; i < entries.length; i++) {
var _callbacks$get2;
(_callbacks$get = callbacks.get(entries[0].target)) === null || _callbacks$get === void 0 ? void 0 : _callbacks$get(entries[0], observer);
} else {
for (var i = 0; i < entries.length; i++) {
var _callbacks$get2;
(_callbacks$get2 = callbacks.get(entries[i].target)) === null || _callbacks$get2 === void 0 ? void 0 : _callbacks$get2(entries[i], observer);
}
(_callbacks$get2 = callbacks.get(entries[i].target)) === null || _callbacks$get2 === void 0 ? void 0 : _callbacks$get2(entries[i], observer);
}
}),
}
});
return {
observer: observer,
subscribe: function subscribe(target, callback) {
return callbacks.set(target, callback);
observer.observe(target);
callbacks.set(target, callback);
},
unsubscribe: function unsubscribe(target) {
return callbacks.delete(target);
observer.unobserve(target);
callbacks.delete(target);
}

@@ -1233,0 +1228,0 @@ };

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):(t=t||self).useResizeObserver=e(t.React)}(this,(function(t){"use strict";function e(t,e){var n=-1;return t.some((function(t,r){return t[0]===e?(n=r,1):0})),n}function n(){this.__entries__=[]}function r(){return this.__entries__.length}function i(t){var n=e(this.__entries__,t),r=this.__entries__[n];return r&&r[1]}function o(t,n){var r=e(this.__entries__,t);~r?this.__entries__[r][1]=n:this.__entries__.push([t,n])}function s(t){var n=this.__entries__,r=e(n,t);~r&&n.splice(r,1)}function c(t){return!!~e(this.__entries__,t)}function u(){this.__entries__.splice(0)}function a(t,e){void 0===e&&(e=null);for(var n=0,r=this.__entries__;n<r.length;n++){var i=r[n];t.call(e,i[1],i[0])}}function h(t){return setTimeout((function(){return t(Date.now())}),1e3/60)}function f(){this.connected_=0,this.mutationEventsAdded_=0,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(t){function e(){i&&(i=0,t()),o&&r()}function n(){P(e)}function r(){var t=Date.now();if(i){if(2>t-s)return;o=1}else i=1,o=0,setTimeout(n,20);s=t}var i=0,o=0,s=0;return r}(this.refresh.bind(this))}function d(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()}function v(t){var e=this.observers_,n=e.indexOf(t);~n&&e.splice(n,1),!e.length&&this.connected_&&this.disconnect_()}function p(){this.updateObservers_()&&this.refresh()}function l(t){return t.gatherActive(),t.hasActive()}function b(t){return t.broadcastActive()}function _(){var t=this.observers_.filter(l);return t.forEach(b),t.length>0}function m(){V&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),J?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:1,childList:1,characterData:1,subtree:1})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=1),this.connected_=1)}function y(){V&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=0,this.connected_=0)}function g(t){var e=t.propertyName,n=void 0===e?"":e;N.some((function(t){return!!~n.indexOf(t)}))&&this.refresh()}function w(){return this.instance_||(this.instance_=new f),this.instance_}function E(t){return parseFloat(t)||0}function O(t){for(var e=[],n=1;arguments.length>n;n++)e[n-1]=arguments[n];return e.reduce((function(e,n){return e+E(t["border-"+n+"-width"])}),0)}function M(t){return t instanceof U(t).SVGGraphicsElement}function A(t){return t instanceof U(t).SVGElement&&"function"==typeof t.getBBox}function R(t){return V?Y(t)?function(t){var e=t.getBBox();return T(0,0,e.width,e.height)}(t):function(t){var e=t.clientWidth,n=t.clientHeight;if(!e&&!n)return X;var r=U(t).getComputedStyle(t),i=function(t){for(var e={},n=0,r=["top","right","bottom","left"];r.length>n;n++){var i=r[n],o=t["padding-"+i];e[i]=E(o)}return e}(r),o=i.left+i.right,s=i.top+i.bottom,c=E(r.width),u=E(r.height);if("border-box"===r.boxSizing&&(Math.round(c+o)!==e&&(c-=O(r,"left","right")+o),Math.round(u+s)!==n&&(u-=O(r,"top","bottom")+s)),!function(t){return t===U(t).document.documentElement}(t)){var a=Math.round(c+o)-e,h=Math.round(u+s)-n;1!==Math.abs(a)&&(c-=a),1!==Math.abs(h)&&(u-=h)}return T(i.left,i.top,c,u)}(t):X}function T(t,e,n,r){return{x:t,y:e,width:n,height:r}}function x(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=T(0,0,0,0),this.target=t}function z(){var t=R(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight}function D(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t}function j(t,e){var n,r,i,o,s,c,u,a=(r=(n=e).x,i=n.y,o=n.width,s=n.height,c="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,u=Object.create(c.prototype),Q(u,{x:r,y:i,width:o,height:s,top:i,right:r+o,bottom:s+i,left:r}),u);Q(this,{target:t,contentRect:a})}function k(t,e,n){if(this.activeObservations_=[],this.observations_=new H,"function"!=typeof t)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=e,this.callbackCtx_=n}function L(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(t instanceof U(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)||(e.set(t,new Z(t)),this.controller_.addObserver(this),this.controller_.refresh())}}function S(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(t instanceof U(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)&&(e.delete(t),e.size||this.controller_.removeObserver(this))}}function q(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)}function W(){var t=this;this.clearActive(),this.observations_.forEach((function(e){e.isActive()&&t.activeObservations_.push(e)}))}function G(t){return new $(t.target,t.broadcastRect())}function B(){if(this.hasActive()){var t=this.callbackCtx_,e=this.activeObservations_.map(G);this.callback_.call(t,e,t),this.clearActive()}}function C(){this.activeObservations_.splice(0)}function F(){return this.activeObservations_.length>0}var H=function(){return"undefined"!=typeof Map?Map:(Object.defineProperty(n.prototype,"size",{get:r,enumerable:1,configurable:1}),n.prototype.get=i,n.prototype.set=o,n.prototype.delete=s,n.prototype.has=c,n.prototype.clear=u,n.prototype.forEach=a,n)}(),V="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,I=function(){return"undefined"!=typeof global&&global.Math===Math?global:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")()}(),P=function(){return"function"==typeof requestAnimationFrame?requestAnimationFrame.bind(I):h}(),N=["top","right","bottom","left","width","height","size","weight"],J="undefined"!=typeof MutationObserver,K=function(){return f.prototype.addObserver=d,f.prototype.removeObserver=v,f.prototype.refresh=p,f.prototype.updateObservers_=_,f.prototype.connect_=m,f.prototype.disconnect_=y,f.prototype.onTransitionEnd_=g,f.getInstance=w,f.instance_=null,f}(),Q=function(t,e){for(var n=0,r=Object.keys(e);n<r.length;n++){var i=r[n];Object.defineProperty(t,i,{value:e[i],enumerable:0,writable:0,configurable:1})}return t},U=function(t){return t&&t.ownerDocument&&t.ownerDocument.defaultView||I},X=T(0,0,0,0),Y=function(){return"undefined"!=typeof SVGGraphicsElement?M:A}(),Z=function(){return x.prototype.isActive=z,x.prototype.broadcastRect=D,x}(),$=function(){return j}(),tt=function(){return k.prototype.observe=L,k.prototype.unobserve=S,k.prototype.disconnect=q,k.prototype.gatherActive=W,k.prototype.broadcastActive=B,k.prototype.clearActive=C,k.prototype.hasActive=F,k}(),et="undefined"!=typeof WeakMap?new WeakMap:new H,nt=function(){return function t(e){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=K.getInstance(),r=new tt(e,n,this);et.set(this,r)}}();["observe","unobserve","disconnect"].forEach((function(t){nt.prototype[t]=function(){var e;return(e=et.get(this))[t].apply(e,arguments)}}));var rt,it=function(){return void 0!==I.ResizeObserver?I.ResizeObserver:nt}(),ot=t["undefined"!=typeof document&&void 0!==document.createElement?"useLayoutEffect":"useEffect"];return function(e,n){var r,i,o,s=rt||(o=new Map,rt={observer:new it((function(t,e){var n;if(1===t.length)null===(n=o.get(t[0].target))||void 0===n||n(t[0],e);else for(var r=0;r<t.length;r++){var i;null===(i=o.get(t[r].target))||void 0===i||i(t[r],e)}})),subscribe:function(t,e){return o.set(t,e)},unsubscribe:function(t){return o.delete(t)}}),c=(r=n,(i=t.useRef(r)).current=r,i);return ot((function(){var t=0,n=e&&"current"in e?e.current:e;if(n)return s.subscribe(n,(function(e,n){t||c.current(e,n)})),function(){t=1,s.unsubscribe(n)}}),[e,s,c]),ot((function(){var t=e&&"current"in e?e.current:e;if(t)return s.observer.observe(t),function(){return s.observer.unobserve(t)}}),[e,s.observer]),s.observer}}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):(t=t||self).useResizeObserver=e(t.React)}(this,(function(t){"use strict";function e(t,e){var n=-1;return t.some((function(t,r){return t[0]===e?(n=r,1):0})),n}function n(){this.__entries__=[]}function r(){return this.__entries__.length}function i(t){var n=e(this.__entries__,t),r=this.__entries__[n];return r&&r[1]}function o(t,n){var r=e(this.__entries__,t);~r?this.__entries__[r][1]=n:this.__entries__.push([t,n])}function s(t){var n=this.__entries__,r=e(n,t);~r&&n.splice(r,1)}function c(t){return!!~e(this.__entries__,t)}function u(){this.__entries__.splice(0)}function a(t,e){void 0===e&&(e=null);for(var n=0,r=this.__entries__;n<r.length;n++){var i=r[n];t.call(e,i[1],i[0])}}function h(t){return setTimeout((function(){return t(Date.now())}),1e3/60)}function f(){this.connected_=0,this.mutationEventsAdded_=0,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(t){function e(){i&&(i=0,t()),o&&r()}function n(){P(e)}function r(){var t=Date.now();if(i){if(2>t-s)return;o=1}else i=1,o=0,setTimeout(n,20);s=t}var i=0,o=0,s=0;return r}(this.refresh.bind(this))}function d(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()}function v(t){var e=this.observers_,n=e.indexOf(t);~n&&e.splice(n,1),!e.length&&this.connected_&&this.disconnect_()}function p(){this.updateObservers_()&&this.refresh()}function l(t){return t.gatherActive(),t.hasActive()}function _(t){return t.broadcastActive()}function b(){var t=this.observers_.filter(l);return t.forEach(_),t.length>0}function m(){V&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),J?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:1,childList:1,characterData:1,subtree:1})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=1),this.connected_=1)}function y(){V&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=0,this.connected_=0)}function g(t){var e=t.propertyName,n=void 0===e?"":e;N.some((function(t){return!!~n.indexOf(t)}))&&this.refresh()}function w(){return this.instance_||(this.instance_=new f),this.instance_}function E(t){return parseFloat(t)||0}function O(t){for(var e=[],n=1;arguments.length>n;n++)e[n-1]=arguments[n];return e.reduce((function(e,n){return e+E(t["border-"+n+"-width"])}),0)}function M(t){return t instanceof U(t).SVGGraphicsElement}function A(t){return t instanceof U(t).SVGElement&&"function"==typeof t.getBBox}function R(t){return V?Y(t)?function(t){var e=t.getBBox();return T(0,0,e.width,e.height)}(t):function(t){var e=t.clientWidth,n=t.clientHeight;if(!e&&!n)return X;var r=U(t).getComputedStyle(t),i=function(t){for(var e={},n=0,r=["top","right","bottom","left"];r.length>n;n++){var i=r[n],o=t["padding-"+i];e[i]=E(o)}return e}(r),o=i.left+i.right,s=i.top+i.bottom,c=E(r.width),u=E(r.height);if("border-box"===r.boxSizing&&(Math.round(c+o)!==e&&(c-=O(r,"left","right")+o),Math.round(u+s)!==n&&(u-=O(r,"top","bottom")+s)),!function(t){return t===U(t).document.documentElement}(t)){var a=Math.round(c+o)-e,h=Math.round(u+s)-n;1!==Math.abs(a)&&(c-=a),1!==Math.abs(h)&&(u-=h)}return T(i.left,i.top,c,u)}(t):X}function T(t,e,n,r){return{x:t,y:e,width:n,height:r}}function x(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=T(0,0,0,0),this.target=t}function z(){var t=R(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight}function D(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t}function j(t,e){var n,r,i,o,s,c,u,a=(r=(n=e).x,i=n.y,o=n.width,s=n.height,c="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,u=Object.create(c.prototype),Q(u,{x:r,y:i,width:o,height:s,top:i,right:r+o,bottom:s+i,left:r}),u);Q(this,{target:t,contentRect:a})}function k(t,e,n){if(this.activeObservations_=[],this.observations_=new H,"function"!=typeof t)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=e,this.callbackCtx_=n}function L(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(t instanceof U(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)||(e.set(t,new Z(t)),this.controller_.addObserver(this),this.controller_.refresh())}}function S(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(t instanceof U(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)&&(e.delete(t),e.size||this.controller_.removeObserver(this))}}function q(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)}function W(){var t=this;this.clearActive(),this.observations_.forEach((function(e){e.isActive()&&t.activeObservations_.push(e)}))}function G(t){return new $(t.target,t.broadcastRect())}function B(){if(this.hasActive()){var t=this.callbackCtx_,e=this.activeObservations_.map(G);this.callback_.call(t,e,t),this.clearActive()}}function C(){this.activeObservations_.splice(0)}function F(){return this.activeObservations_.length>0}var H=function(){return"undefined"!=typeof Map?Map:(Object.defineProperty(n.prototype,"size",{get:r,enumerable:1,configurable:1}),n.prototype.get=i,n.prototype.set=o,n.prototype.delete=s,n.prototype.has=c,n.prototype.clear=u,n.prototype.forEach=a,n)}(),V="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,I=function(){return"undefined"!=typeof global&&global.Math===Math?global:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")()}(),P=function(){return"function"==typeof requestAnimationFrame?requestAnimationFrame.bind(I):h}(),N=["top","right","bottom","left","width","height","size","weight"],J="undefined"!=typeof MutationObserver,K=function(){return f.prototype.addObserver=d,f.prototype.removeObserver=v,f.prototype.refresh=p,f.prototype.updateObservers_=b,f.prototype.connect_=m,f.prototype.disconnect_=y,f.prototype.onTransitionEnd_=g,f.getInstance=w,f.instance_=null,f}(),Q=function(t,e){for(var n=0,r=Object.keys(e);n<r.length;n++){var i=r[n];Object.defineProperty(t,i,{value:e[i],enumerable:0,writable:0,configurable:1})}return t},U=function(t){return t&&t.ownerDocument&&t.ownerDocument.defaultView||I},X=T(0,0,0,0),Y=function(){return"undefined"!=typeof SVGGraphicsElement?M:A}(),Z=function(){return x.prototype.isActive=z,x.prototype.broadcastRect=D,x}(),$=function(){return j}(),tt=function(){return k.prototype.observe=L,k.prototype.unobserve=S,k.prototype.disconnect=q,k.prototype.gatherActive=W,k.prototype.broadcastActive=B,k.prototype.clearActive=C,k.prototype.hasActive=F,k}(),et="undefined"!=typeof WeakMap?new WeakMap:new H,nt=function(){return function t(e){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=K.getInstance(),r=new tt(e,n,this);et.set(this,r)}}();["observe","unobserve","disconnect"].forEach((function(t){nt.prototype[t]=function(){var e;return(e=et.get(this))[t].apply(e,arguments)}}));var rt,it=function(){return void 0!==I.ResizeObserver?I.ResizeObserver:nt}(),ot=t["undefined"!=typeof document&&void 0!==document.createElement?"useLayoutEffect":"useEffect"];return function(e,n){var r,i,o,s,c=rt||(o=new Map,s=new it((function(t,e){var n;if(1===t.length)null===(n=o.get(t[0].target))||void 0===n||n(t[0],e);else for(var r=0;r<t.length;r++){var i;null===(i=o.get(t[r].target))||void 0===i||i(t[r],e)}})),rt={observer:s,subscribe:function(t,e){s.observe(t),o.set(t,e)},unsubscribe:function(t){s.unobserve(t),o.delete(t)}}),u=(r=n,(i=t.useRef(r)).current=r,i);return ot((function(){var t=0,n=e&&"current"in e?e.current:e;if(n)return c.subscribe(n,(function(e,n){t||u.current(e,n)})),function(){t=1,c.unsubscribe(n)}}),[e,c,u]),c.observer}}));
//# sourceMappingURL=use-resize-observer.js.map
{
"name": "@react-hook/resize-observer",
"version": "1.1.1",
"version": "1.1.2",
"homepage": "https://github.com/jaredLunde/react-hook/tree/master/packages/resize-observer#readme",

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

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