kitzo 2.3.39 → 2.3.41

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.
@@ -1,26 +1,26 @@
1
- import { useState as o, useRef as u, useEffect as c } from "react";
2
- function d(n = 30) {
3
- const [t, r] = o({
4
- screenWidth: window.innerWidth,
5
- screenHeight: window.innerHeight
6
- }), e = u(null);
7
- return c(() => {
8
- function i() {
1
+ import t from "react";
2
+ function c(i = 30) {
3
+ const [r, o] = t.useState({
4
+ screenWidth: 0,
5
+ screenHeight: 0
6
+ }), e = t.useRef(null);
7
+ return t.useEffect(() => {
8
+ function n() {
9
9
  e.current && clearTimeout(e.current), e.current = setTimeout(
10
10
  () => {
11
- r({
11
+ o({
12
12
  screenWidth: window.innerWidth,
13
13
  screenHeight: window.innerHeight
14
14
  });
15
15
  },
16
- Math.max(0, +n)
16
+ Math.max(0, +i)
17
17
  );
18
18
  }
19
- return typeof window < "u" && window.addEventListener("resize", i), () => {
20
- e.current && clearTimeout(e.current), window.removeEventListener("resize", i);
19
+ return typeof window < "u" && (n(), window.addEventListener("resize", n)), () => {
20
+ typeof window < "u" && window.removeEventListener("resize", n), e.current && clearTimeout(e.current);
21
21
  };
22
- }, [n]), t;
22
+ }, [i]), r;
23
23
  }
24
24
  export {
25
- d as default
25
+ c as default
26
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitzo",
3
- "version": "2.3.39",
3
+ "version": "2.3.41",
4
4
  "description": "A lightweight React micro-utility.",
5
5
  "type": "module",
6
6
  "files": [