Class: VirtualList

VirtualList(bridgesopt, propsopt)

Built-in component for high-performance virtualized list rendering. Only renders items currently visible within the viewport. Supports optional pagination mode with pageSize, current page tracking, and navigation controls.

Constructor

new VirtualList(bridgesopt, propsopt)

Parameters:
Name Type Attributes Description
bridges object <optional>

External bridges.

props object <optional>

Component properties (items, itemHeight, pageSize, page, totalItems, showControls).

Source:

Classes

VirtualList

Members

currentPage

Currently active 1-based page index. @type {number}

Source:

itemVar

Loop item variable name (e.g. 'item'). @type {string}

Source:

lastViewportHeight

Cached viewport height to prevent redundant layout loops. @type {number}

Source:

measuredHeights

Measured actual heights of individual items. @type {number[]}

Source:

rafId

Animation frame request handle. @type {number|null}

Source:

resizeObserver

Resize observer to monitor dynamic item size changes and viewport resizing. @type {ResizeObserver|null}

Source:

scrollRafId

Animation frame request handle for scroll throttling. @type {number|null}

Source:

templateNode

The template node extracted from slot transclusion. @type {HTMLTemplateElement|null}

Source:

Methods

createItemElement() → {Element}

Creates a fresh element structure from the template to populate recycled element pool.

Source:
Returns:
Type
Element

goToPage(targetPage)

Navigates to a specific page when pagination is enabled.

Parameters:
Name Type Description
targetPage number

1-based target page index.

Source:

initResizeObserver()

Initializes unified ResizeObserver for viewport container and row items.

Source:

layout()

Measures visible DOM nodes and updates layout variables (e.g., offsets/heights/scrollbars/pagination).

Source:

nextPage()

Navigates to the next page.

Source:

onMount()

Lifecycle hook called after component is mounted. Sets up transcluded template slots, scroll listeners, and pagination handlers.

Source:

onScroll()

Viewport scroll event handler. Throttles scroll processing via requestAnimationFrame to align rendering with the screen refresh rate.

Source:

onUnmount()

Lifecycle hook called when component unmounts. Clean up event listeners and observers to prevent leaks.

Source:

onUpdate()

Lifecycle hook called after component updates. Re-evaluates virtualization layouts when properties (e.g. items, page) change.

Source:

prevPage()

Navigates to the previous page.

Source:

scheduleLayout()

Schedules layout recalculation on the next animation frame to prevent layout thrashing.

Source: