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

Method updateState

src/container.ts:173–192  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

171 }
172
173 updateState() {
174 var viewportTop = scrollTop(this.item);
175 var viewportHeight = getViewportHeight(this.item);
176 var contentHeight = getContentHeight(this.item);
177
178 var needsRecalcuate =
179 viewportHeight !== this.viewportHeight || contentHeight !== this.contentHeight;
180
181 this.viewportTop = viewportTop;
182 this.viewportHeight = viewportHeight;
183 this.viewportBottom = viewportTop + viewportHeight;
184 this.contentHeight = contentHeight;
185
186 if (needsRecalcuate) {
187 let i = this.watchers.length;
188 while (i--) {
189 this.watchers[i].recalculateLocation();
190 }
191 }
192 }
193
194 updateAndTriggerWatchers(event: ScrollEvent) {
195 let i = this.watchers.length;

Callers 4

DOMListenerMethod · 0.95
createContainerMethod · 0.95
index.tsFile · 0.80
testEntry.tsFile · 0.80

Calls 3

scrollTopFunction · 0.85
getContentHeightFunction · 0.85
getViewportHeightFunction · 0.70

Tested by

no test coverage detected