Home / Function/ onScrollEnd() — astro Function Reference

onScrollEnd() — astro Function Reference

Architecture documentation for the onScrollEnd() function in router.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  8da5c9ab_cf12_edc2_9dbc_d83919b14c0c["onScrollEnd()"]
  2b5c33e2_176e_e839_f05f_7f10493f4f74["router.ts"]
  8da5c9ab_cf12_edc2_9dbc_d83919b14c0c -->|defined in| 2b5c33e2_176e_e839_f05f_7f10493f4f74
  129594d7_9bf0_c870_be2d_a82b4a465587["scrollInterval()"]
  129594d7_9bf0_c870_be2d_a82b4a465587 -->|calls| 8da5c9ab_cf12_edc2_9dbc_d83919b14c0c
  style 8da5c9ab_cf12_edc2_9dbc_d83919b14c0c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/transitions/router.ts lines 618–627

const onScrollEnd = () => {
	// NOTE: our "popstate" event handler may call `pushState()` or
	// `replaceState()` and then `scrollTo()`, which will fire "scroll" and
	// "scrollend" events. To avoid redundant work and expensive calls to
	// `replaceState()`, we simply check that the values are different before
	// updating.
	if (history.state && (scrollX !== history.state.scrollX || scrollY !== history.state.scrollY)) {
		updateScrollPosition({ scrollX, scrollY });
	}
};

Domain

Subdomains

Called By

Frequently Asked Questions

What does onScrollEnd() do?
onScrollEnd() is a function in the astro codebase, defined in packages/astro/src/transitions/router.ts.
Where is onScrollEnd() defined?
onScrollEnd() is defined in packages/astro/src/transitions/router.ts at line 618.
What calls onScrollEnd()?
onScrollEnd() is called by 1 function(s): scrollInterval.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free