get-client-window-height
Version:
A safe way of returning the interior height of the window in pixels
16 lines (12 loc) • 306 B
text/typescript
const isSupported = () => typeof window !== 'undefined';
export const getClientWindowHeight = () => {
if (!isSupported()) {
return 0;
}
return (
window.innerHeight ||
document.documentElement.clientHeight ||
document.body.clientHeight
);
};
export default getClientWindowHeight;