@wistia/vhs 6.0.5-beta.eb21eea4.2b3831d → 6.0.6-beta.2c41702b.b4bc60f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +14 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/vhs v6.0.
|
|
3
|
+
* @license @wistia/vhs v6.0.6-beta.2c41702b.b4bc60f
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2021-2026, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -2043,12 +2043,20 @@ const useWindowSize = (interval = 0) => {
|
|
|
2043
2043
|
height: isClient() ? window.innerHeight : 0
|
|
2044
2044
|
});
|
|
2045
2045
|
useLayoutEffect(() => {
|
|
2046
|
-
const
|
|
2047
|
-
width: window
|
|
2048
|
-
height:
|
|
2049
|
-
|
|
2046
|
+
const updateDimensions = () => {
|
|
2047
|
+
const { innerWidth: width, innerHeight: height } = window;
|
|
2048
|
+
setDimensions((prev) => prev.width === width && prev.height === height ? prev : {
|
|
2049
|
+
width,
|
|
2050
|
+
height
|
|
2051
|
+
});
|
|
2052
|
+
};
|
|
2053
|
+
const handleResize = debounce(interval, updateDimensions);
|
|
2054
|
+
updateDimensions();
|
|
2050
2055
|
window.addEventListener("resize", handleResize);
|
|
2051
|
-
return () =>
|
|
2056
|
+
return () => {
|
|
2057
|
+
window.removeEventListener("resize", handleResize);
|
|
2058
|
+
handleResize.cancel();
|
|
2059
|
+
};
|
|
2052
2060
|
}, [interval]);
|
|
2053
2061
|
return dimensions;
|
|
2054
2062
|
};
|