MCPcopy
hub / github.com/stutrek/scrollmonitor / getViewportHeight

Function getViewportHeight

src/container.ts:5–17  ·  view source on GitHub ↗
(element: HTMLElement)

Source from the content-addressed store, hash-verified

3import { Watcher } from './watcher.js';
4
5function getViewportHeight(element: HTMLElement) {
6 if (isOnServer) {
7 return 0;
8 }
9 if(typeof window !== 'undefined'){
10 return window.innerHeight;
11 }
12 if (element === document.body) {
13 return document.documentElement.clientHeight;
14 } else {
15 return element.clientHeight;
16 }
17}
18
19function getContentHeight(element: HTMLElement) {
20 if (isOnServer) {

Callers 2

constructorMethod · 0.70
updateStateMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected