MCPcopy Index your code
hub / github.com/ChatGPTNextWeb/NextChat / useWindowSize

Function useWindowSize

app/utils.ts:121–143  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

119}
120
121export function useWindowSize() {
122 const [size, setSize] = useState({
123 width: window.innerWidth,
124 height: window.innerHeight,
125 });
126
127 useEffect(() => {
128 const onResize = () => {
129 setSize({
130 width: window.innerWidth,
131 height: window.innerHeight,
132 });
133 };
134
135 window.addEventListener("resize", onResize);
136
137 return () => {
138 window.removeEventListener("resize", onResize);
139 };
140 }, []);
141
142 return size;
143}
144
145export const MOBILE_MAX_WIDTH = 600;
146export function useMobileScreen() {

Callers 2

PreCodeFunction · 0.90
useMobileScreenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected