@os-design/utils
Advanced tools
Comparing version 1.0.18 to 1.0.19
@@ -10,2 +10,4 @@ "use strict"; | ||
var _resizeObserverPolyfill = _interopRequireDefault(require("resize-observer-polyfill")); | ||
var _useBrowserLayoutEffect = _interopRequireDefault(require("../useBrowserLayoutEffect")); | ||
@@ -21,3 +23,3 @@ | ||
*/ | ||
var useResizeObserver = function useResizeObserver(target, listener, options) { | ||
var useResizeObserver = function useResizeObserver(target, listener) { | ||
var listenerRef = (0, _react.useRef)(); | ||
@@ -43,8 +45,8 @@ (0, _react.useEffect)(function () { | ||
var resizeObserver = new ResizeObserver(eventListener); | ||
resizeObserver.observe(element, options); | ||
var resizeObserver = new _resizeObserverPolyfill["default"](eventListener); | ||
resizeObserver.observe(element); | ||
return function () { | ||
return resizeObserver.unobserve(element); | ||
}; | ||
}, [target, options]); | ||
}, [target]); | ||
}; | ||
@@ -51,0 +53,0 @@ |
import { useEffect, useRef } from 'react'; | ||
import ResizeObserver from 'resize-observer-polyfill'; | ||
import useBrowserLayoutEffect from '../useBrowserLayoutEffect'; | ||
@@ -8,3 +9,3 @@ /** | ||
const useResizeObserver = (target, listener, options) => { | ||
const useResizeObserver = (target, listener) => { | ||
const listenerRef = useRef(); | ||
@@ -29,5 +30,5 @@ useEffect(() => { | ||
const resizeObserver = new ResizeObserver(eventListener); | ||
resizeObserver.observe(element, options); | ||
resizeObserver.observe(element); | ||
return () => resizeObserver.unobserve(element); | ||
}, [target, options]); | ||
}, [target]); | ||
}; | ||
@@ -34,0 +35,0 @@ |
@@ -1,5 +0,4 @@ | ||
/// <reference types="resize-observer-browser" /> | ||
import { RefObject } from 'react'; | ||
declare const useResizeObserver: (target: Element | RefObject<Element>, listener: ResizeObserverCallback, options?: ResizeObserverOptions | undefined) => void; | ||
declare const useResizeObserver: (target: Element | RefObject<Element>, listener: ResizeObserverCallback) => void; | ||
export default useResizeObserver; | ||
//# sourceMappingURL=index.d.ts.map |
{ | ||
"name": "@os-design/utils", | ||
"version": "1.0.18", | ||
"version": "1.0.19", | ||
"license": "UNLICENSED", | ||
@@ -38,3 +38,6 @@ "repository": "git@gitlab.com:os-team/libs/os-design.git", | ||
}, | ||
"gitHead": "cde59209cb285c2fc5742965b599ba104b84f4ae" | ||
"dependencies": { | ||
"resize-observer-polyfill": "^1.5.1" | ||
}, | ||
"gitHead": "97433cefc19d9d44aa758a590f52c2784bedfad8" | ||
} |
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
136445
1258
2
+ Addedresize-observer-polyfill@1.5.1(transitive)