Skip to content

InfinityScroll

Unofficial

Virtual scrolling component that renders only visible items in large lists for performance.

Import:

import type { InfinityScroll } from '@obsidian-typings/obsidian-public-latest';

Signature:

export interface InfinityScroll

Properties

PropertyTypeDescription
blockSizenumberNumber of items laid out per compute pass. It starts at 50, doubles (up to 1000) after a fast unfinished pass, halves after a slow one, and resets to 50 once the tree is fully computed or invalidated.
cancelCompute(() => void) | nullCancels the pending compute pass, or null if none is pending.
heightnumberCurrent visible height of the scroll container.
lastPassnumberThe performance.now() timestamp of the last compute pass.
lastScrollnumberLast recorded scroll position.
minPassIntervalnumberMinimum time between compute passes, in milliseconds. Search raises it to 100 while it runs.
rootElunknownRoot element of the virtual scroll container.
scrollElHTMLElementScrollable element that handles scroll events.
setWidthbooleanWhether the width should be explicitly set on items.
widthnumberCurrent visible width of the scroll container.

Methods

MethodReturnsDescription
_layout(x, y)unknownInternal method to perform layout calculations.
_measure(x)unknownInternal method to measure element dimensions.
_precompute(x)unknownInternal method to precompute layout information.
compute(x)unknownCompute visible items and update the virtual display.
findElementTop(x, y, z)unknownFind the top position of an element within the scroll container.
getRootTop()unknownGet the top offset of the root element.
invalidate(x, y)unknownInvalidate the cached layout for specific items.
invalidateAll()unknownInvalidate all cached layout information.
measure(x, y)unknownMeasure dimensions for the given elements.
onResize()unknownHandle resize events and recalculate layout.
onScroll()unknownHandle scroll events and update the virtual display.
queueCompute()unknownQueue a deferred computation of visible items.
scrollIntoView(x, y)unknownScroll the container to bring the specified element into view.
setMinPassInterval(interval)voidSet the minimum time between compute passes, rescheduling a pending pass to respect it.
update(x, y, z, u, v, w)unknownUpdate the virtual scroll state with new parameters.
updateVirtualDisplay(x)unknownUpdate the virtual display to reflect current scroll position.

Links to this page: