MCPcopy Index your code
hub / github.com/OpenSignLabs/OpenSign / useWindowSize

Function useWindowSize

apps/OpenSign/src/hook/useWindowSize.js:3–25  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1import { useEffect, useState } from "react";
2
3export function useWindowSize() {
4 const [size, setSize] = useState({
5 width: 0,
6 height: 0
7 });
8
9 const onResize = () => {
10 setSize({
11 width: window.innerWidth,
12 height: window.innerHeight
13 });
14 };
15
16 useEffect(() => {
17 onResize();
18 window.addEventListener("resize", onResize);
19 return () => {
20 window.removeEventListener("resize", onResize);
21 };
22 }, []);
23
24 return size;
25}

Callers 8

HeaderFunction · 0.90
SidebarFunction · 0.90
PlaceHolderSignFunction · 0.90
SignYourSelfFunction · 0.90
TemplatePlaceholderFunction · 0.90
LoginFunction · 0.90
PdfRequestFilesFunction · 0.90
DebugPdfFunction · 0.90

Calls 1

onResizeFunction · 0.70

Tested by

no test coverage detected